pug-loader: Cannot resolve module 'fs'
Hey there, thanks for the loader,
I get the following warning when running Webpack with this loader.
WARNING in ./~/jade/lib/runtime.js
Module not found: Error: Cannot resolve module 'fs' in /Users/Username/Dev/www/project/node_modules/jade/lib
@ ./~/jade/lib/runtime.js 180:18-31
I think found a possible solution which I think you actually gave @sokra. https://gitter.im/webpack/webpack/archives/2014/08/26 looks like you need to add
"browser": { "fs": false }
https://github.com/kangax/fabric.js/blob/master/package.json#L17-L21
Could be alos that I screwed something up, thanks in advance for any help
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 7
- Comments: 20
add this to your config:
This can also be fixed on library level. The library using
fscan add this to thepackage.json:to say: “For browser build I don’t need the
fspackage. Give me an empty one.”.I have already added that code but unfortunately I am still having the same error. Below is my code
module.exports = { entry: __dirname + “/app/assets/scripts/app.js”,
}
@afoysal in case anyone is still confused. it should be added like:
I don’t understand why I’m getting this error, because I’m only using the
pathmodule in mywebpack.config.js. Shouldn’t it only complain if my browser code accidentally requirespath?I solved with:
target: "async-node"target: “async-node”
@omerts (just my guess) setting
fstoemptytells webpack that there is NO implementation of thefsmodule. Take a look at thisnode-lib-browsermodule. By default, webpack’s target is ‘web’. There is no implementation for some of the node core libraries, such as fs, os, net, etc. That is where ‘node-lib-browser’ comes into the picture. Forfs, there is NO implementation, and thus should be set asempty. You may want to first check why you havefsas a dependency.