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.

error when setting 'node: false' in webpack config

See original GitHub issue

when 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:closed
  • Created 6 years ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
lutzkcommented, Aug 3, 2017

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

0reactions
faceyspaceycommented, Aug 4, 2017

yea, close it.

Read more comments on GitHub >

github_iconTop 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 >

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