Set output.globalObject to `this`
Created by: kentcdodds
When using workerize-loader, things work great (it's a fantastic tool), except that it does not work in dev mode. This is because HotModuleReplacement gets loaded into the webworker and the HMR file references window
.
Describe the solution you'd like
I'd like to have the webpack configuration set output.globalObject
to 'this'
. The default is 'window'
. Changing it to 'this'
will have no negative impact on existing or future users, and it will allow people to begin using workerize-loader without ejecting.
Describe alternatives you've considered
You can manually modify the configuration in node_modules
(and just remember to do that anytime you re-install deps). Or you can eject.
Additional context
Before:
After:
This code is generated from this template: