Closed gingerchris closed 2 years ago
I think this will also address the issue raised in https://github.com/chrisdickinson/raf/issues/46
global is defined in node, and every non-broken node module bundler rewrites global into window.
If you’re using webpack 5, for example, you’ll need to un break it by configuring it to polyfill node globals and core modules.
@ljharb thanks for looking into this - sorry it's no good in it's current state! I will dig a bit further into my current use-case and see if I can resolve it without changes here.
When running this package in a web worker,
window
is undefined - but so isglobal
, which causes the browser to throw an error when trying to setroot
This update adds support for workers by using
globalThis
ifglobal
is falsey.