error when setting 'node: false' in webpack config
See original GitHub issuewhen i set node: false
(to reduce bytes to transfer) in my webpack frontend config i get the error:
Module not found: Error: Can't resolve 'path' in '__REPLACED__/src/app/universalComponent'
this is because the code transformed by the plugin makes use of __dirname
in the path
key wich is disabled by node: false
transformed code:
Home: __WEBPACK_IMPORTED_MODULE_4_react_universal_component___default()(__WEBPACK_IMPORTED_MODULE_2_babel_plugin_universal_import_universalImport_js___default()({
...
path: () => __WEBPACK_IMPORTED_MODULE_0_path___default.a.join(__dirname, '../containers/Home'), <------ __dirname
...
})
its fixed when i set node
to:
node = {
Buffer: false,
__dirname: true, // <------ note its enabled
__filename: false,
console: false,
global: false,
process: false,
};
instead of false
i am not sure if this can be “fixed” from your site but i think it would be good to add a note in one of the readmes of the coresponding repos like react-universal-component
i could add a note - just let me kow to wich repos it should be added
Issue Analytics
- State:
- Created 6 years ago
- Comments:17 (7 by maintainers)
Top Results From Across the Web
Webpack Error - configuration.node has an unknown property 'fs'
I am attempting to use a parser generator library (antlr4) that works both in a Node. js environment, as well as in browsers....
Read more >Node - webpack
The following Node.js options configure whether to polyfill or mock certain ... Since webpack 3.0.0, the node option may be set to false...
Read more >How I solved and debugged my Webpack issue through trial ...
I tried to use webpack.SourceMapDevToolPlugin but it didn't work with my setup, even when I deleted devtools or set them to false; I...
Read more >How to polyfill node core modules in webpack 5 - Alchemy
The main issue with create-react-app and the polyfill error is that create-react-app, by default, hides the webpack config file inside the ...
Read more >@nuxt/friendly-errors-webpack-plugin - npm
You need to turn off all error logging by setting your webpack config quiet option to true. app.use(require(' ...
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
i pulled the updated demo from scratch and it works now to set node: false without error dont worry i just wanted to report it back to you as i found it thank you a lot! closing then
yea, close it.