I have a very simple wrapper module around a global object set by the environment in which scripts are run. The wrapper module simply does:
module.exports = global.foobar;
Previously, when I used the browser, this worked fine. When the browser globalwas the same as window.
However, I switch to webpack, and after starting webpack, the value globalhas changed. In the browser, it is no longer an alias window, instead it is undefined, and I get cannot read property foobar of undefined.
Now, in the case of my wrapper module, I can fix it in other ways, but I have other dependencies, and then the package is used in the chain buffer. This package is also used global( see here ), as well as crashing after starting webpack:
Uncaught TypeError: Cannot read property 'TYPED_ARRAY_SUPPORT' of undefined
Is there a way to make webpack treat globaljust like the browser did, with globalbeing an alias window?
source
share