Closed mlegore closed 7 years ago
!module.parent
is a very common convention for detecting if you are in the main file. webpack needs to have something for this. rc
is a very popular and stable module, if webpack doesn't work well with it, the problem is that webpack doesn't work well with node modules.
I just saw your comment here: https://github.com/webpack/webpack/issues/20 I agree that webpack should at least support this case.
Meanwhile there is also this method:
require.main === module
which is supported by webpack
https://github.com/webpack/webpack/issues/64
I am working on packing up a project that references RC in electron & vue using webpack, and I've found that rc does not play nicely with webpack.
I'm getting the following error:
A JavaScript error occurred in the main process Uncaught Exception: Error: rc(name): name must be string
The offending lines in rc:
if(!module.parent) { console.log( JSON.stringify(module.exports(process.argv[2]), false, 2) ) }
module.parent is not respected by webpack (nor will it be https://github.com/webpack/webpack/issues/1569)