-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HMR breaks on changes unless "name" is specified in Worker constructor #4
Comments
Hey @barretron! I am terribly sorry, I just saw your issue. For some reason I wasn't automatically watching the repository... Is that still an issue or did you give up on it by now? |
No worries! It's still an issue, but I was able to work around it once I figured out what was going on by using the |
I just ported the latest changes of |
@andywer the changes prevented that app from crashing, but unfortunately the chunk name seems to be incremented each reload, resulting in an accumulation of new workers each time. The chunk name needs to remain the same through each reload so that webpack knows which module to replace. |
I just saw that there is a subtle difference to the latest version of the Can you quickly try monkey-patching your local WorkerPlugin.prototype.apply = function apply (compiler) {
var workerId = 0;
compiler.hooks.normalModuleFactory.tap(NAME, function (factory) {
+ workerId = 0;
for (var i = 0, list = JS_TYPES; i < list.length; i += 1) { |
Without "name" specified as a second argument to the
Worker
constructor, Webpack HMR compilation fails whenever the worker file changes:Initial compile at startup:
On change:
When "name" is specified, it's used as the entrypoint name and the compilation succeeds, e.g.
It might also be worth noting that changing the name while the dev server is running also breaks HMR.
While documenting this would be good, I wonder if an entrypoint name could be generated instead.
The text was updated successfully, but these errors were encountered: