brunch / deppack

Extract node modules to browser.
MIT License
4 stars 13 forks source link

Obtain the global object in more situations. #45

Closed jacksonrayhamilton closed 7 years ago

jacksonrayhamilton commented 7 years ago

When using Brunch to concatenate files (while also using my patch from https://github.com/brunch/commonjs-require-definition/pull/22), and then after loading a concatenated file as a web worker, I get the following error: Uncaught ReferenceError: window is not defined. The offending statement is this one: var global = window;. This patch allows us to obtain the global object in web workers and other environments.

paulmillr commented 7 years ago

I think this patch may break something. Can you change this to typeof window === 'undefined' ? this : window?

jacksonrayhamilton commented 7 years ago

Sure, just updated.