HMR is not working for web workers
See original GitHub issueBug report
What is the current behavior?
When updating the code loaded by web worker nothing happens.
If the current behavior is a bug, please provide the steps to reproduce.
This is a very simple configuration where HMR doesn’t work: https://github.com/wclr/webpack-worker-hot-reload
What is the expected behavior?
I believe it should work the following way:
- If the worker’s entry script accepts hot reload, hot reload should be executed in the context of running web worker(s).
- Otherwise it should be upstreamed to the parent context (probably parent script where
new URL
of the worker script was created).
Other relevant information: webpack version: 5 Node.js version: 14 Operating System: Additional tools:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:14 (14 by maintainers)
Top Results From Across the Web
HMR with Angular running as a web worker with platform ...
I am attempting to implement a web worker based app using platformWorkerAppDynamic etc., but I am having some difficulties implementing HMR. If I...
Read more >Web Workers | webpack - JS.ORG
As of webpack 5, you can use Web Workers without worker-loader . Syntax. new Worker(new URL('./worker.js', import.meta.url)); // or customize the chunk name ......
Read more >Hot Module Replacement - SurviveJS
Hot Module Replacement (HMR) builds on top of the WDS. It enables an interface that makes it possible to swap modules live. For...
Read more >Loading web workers using Webpack 5 · mmazzarolo.com
Web workers are restricted by a same-origin policy, so if your webpack assets are not being served from the same origin as your...
Read more >Troubleshooting - Vite
The path to your project folder may include & , which doesn't work with npm on ... If HMR is not handled by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Will do!
Yep, bug, we should fix it, if you want to help feel free to send a PR
Yep, a good question, ideally you need to pass path to worker as argument (you will faced with the same problem not only for webpack, for any other bundlers), multi compiler mode can be useful here too