WebPack - Issue : Error: Can't resolve 'fs'
See original GitHub issueThank you for submitting an issue to jsPDF. Please read carefully.
Are you using the latest version of jsPDF?
The issue occurs after upgrading from 1.3.5 to 1.4.0 (npm version). My project uses Webpack to build a bundle.
Have you tried using jspdf.debug.js?
I did. the error occurs on line 5387:14-27 (var fs = require('fs');
)
var nodeJSMethod = function nodeJSMethod(path, sync, callback) {
sync = sync || true;
var fs = require('fs');
if (sync === true) {
var data = fs.readFileSync(path).toString();
return data;
} else {
fs.readFile('image.jpg', function (err, data) {
callback(data);
});
}
};
Steps to reproduce
It happens when I use webpack to build my project
Ideally a link too. Try fork this http://jsbin.com/rilace/edit?html,js,output
What I saw
ERROR in ./node_modules/jspdf/dist/jspdf.debug.js
Module not found: Error: Can't resolve 'fs' in '.\node_modules\jspdf\dist'
@ ./node_modules/jspdf/dist/jspdf.debug.js 5387:14-27
What I expected
Expected webpack to complete without error as it did in v1.3.5
Issue Analytics
- State:
- Created 5 years ago
- Reactions:17
- Comments:25 (1 by maintainers)
Top Results From Across the Web
Module not found: Error: Can't resolve 'fs' in - Stack Overflow
I found a possible solution, that you have to put some configuration in one of the node_modules. But I think that is not...
Read more >Can't resolve 'fs' when bundle with webpack #447 - GitHub
I got this error when using the "fetch" library from npm. At first I got the same error but with other packages (...
Read more >Can't resolve 'fs' error in Next.js and WebPack - Nsikak Imoh
The Module not found: Can't resolve 'fs' in Next.js error occurs when you import a Node.js module that is not available in the...
Read more >Module not found: Can't resolve 'fs' error [Solved] | bobbyhadz
The error "Module not found: Error: Can't resolve 'fs'" occurs because there has been a breaking change in Webpack version 5. To solve...
Read more >can't resolve fs in node_modules - You.com | The AI Search ...
I think the problem is related to webpack, I had the same problem on a next js project and here's ... Module not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue. We cannot update our projects to Angular6 because of this issue. Would appreciate any workaround.
@arasabbasi At the moment I can’t get angular to work with this version, and I don’t want to eject my project into a webpack one. It’s possible it doesn’t work anymore. If anyone has a solution, then please post here.