tonyg/js-nacl

import fails with error about inability to resolve 'fs'

NullVoxPopuli opened this issue · 4 comments

[Solution: The problem is apparently a bug in Webpack, and a suggested workaround (from here via this comment from @balinskia) is to 'add the following to your Webpack config: node: { fs: "empty" }'. Original bug report text follows.]


All I did was:

import NaCl from 'js-nacl';

which resulted in:

web_1         | ERROR in ./~/js-nacl/lib/nacl_factory.js
web_1         | Module not found: Error: Can't resolve 'fs' in '/src/app/node_modules/js-nacl/lib'
web_1         |  @ ./~/js-nacl/lib/nacl_factory.js 27:1242-1255
web_1         |  @ ./js/actions/identity/config.js
web_1         |  @ ./js/reducers/identity/config.js
web_1         |  @ ./js/reducers/identity/index.js
web_1         |  @ ./js/reducers/index.js
web_1         |  @ ./js/redux-store.js
web_1         |  @ ./js/main.js
web_1         |  @ multi (webpack)-dev-server/client?http://0.0.0.0:4000 webpack/hot/dev-server ./js/main.js
web_1         | webpack: Failed to compile.

this is a react app. :-\

here is a link to the file:

https://github.com/NullVoxPopuli/tanqueReact/blob/c95a968c6e2ec84c5c17c3eddd134d2b553acdc2/js/actions/identity/config.js#L4

Same thing for me. Wondering if this may be the solution:
https://stackoverflow.com/questions/28969861/managing-jquery-plugin-dependency-in-webpack
Will report back

Any progress?

Found solution:
webpack-contrib/css-loader#447
Cheers!

tonyg commented

Thanks, @balinskia! Looks plausible.