Closed kevinramharak closed 3 years ago
Well my PR would fix it in this wrapper, but the resolve
pacakge requires something like rollup-plugin-node-globals
anyway. Since that package is not made with the browser in mind i'll leave it up to you guys if this should be merged
process
is a node core module, so any properly functioning node module bundler will provide a shim for it.
If rollup (like webpack 5) fails to do this by default, I'd file a bug.
This issue is not about the module process
but about the usage of the global process
. I indeed fixed it with a plugin that looks for usages of these globals and replaces them with references to my supplied shim.
Since this is a widely used pattern in the ecosystem this PR is pointless. I do find it ironic that if everyone used require('process')
instead of relying on global variables this pattern would have looked differnt.
Right. I'm saying the global itself (all node globals) must be polyfilled by a node module bundler, or else the bundler is broken.
Ah like that. Yeah with some extra configuration i managed to work it out.
https://github.com/browserify/browser-resolve/blob/master/index.js#L11 uses the global
process
. Im not sure if this is intended but this crashes my bundle at runtime becauseprocess
is not defined. I do have thefs
,path
andprocess
shimmed but that only replaces the imports not the variable reference.I propose to add an explicit require to support this case: