question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Newest build version can't be used with a file bundler like webpack

See original GitHub issue

With this commit an loadImageFile method was added. In this method you require the node module “fs” / filesystem. Even if this code will never be executed in a browser, modern web bundlers will try to require a module named “fs”. But of course there isn’t any. The current build can’t be used in a webpack based environment. The error message when trying to use jsPDF as a module:

ERROR in .../jspdf.js
Module not found: Error: Can't resolve 'fs' in '.../'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
prathu25Mcommented, May 30, 2018

which webpack file ? webpack.common.js webpack.dev.js webpack.prod.js webpack.test.js

1reaction
crazyx13thcommented, May 22, 2018

for webpack you can use

node: {
   fs: 'empty'
},
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't resolve 'fs' when bundle with webpack #447 - GitHub
to webpack config file and the error is gone. Not sure how it works, It seems like webpack did some thing with fs...
Read more >
webpack does not actually create any bundle file
According to https://webpack.github.io/docs/configuration.html#output-path. The output directory as an absolute path (required).
Read more >
Output Management - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Webpack 5 release (2020-10-10)
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Output - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found