Different web workers in the application refer to the one file
See original GitHub issueπ Bug report
Command (mark with an x)
- [ ] new
- [x] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Description
I have created a simple app with two components and two web workers in both of them. After starting the application with the ng serve command, I canβt access the different web workers, only one of them. Different paths refer to a single bundle compiled. See the picture
π¬ Minimal Reproduction
git clone https://github.com/destus90/webworkers
npm ci
ng serve
π Your Environment
Angular CLI: 8.0.0
Node: 12.3.1
OS: win32 x64
Angular: 8.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.0
@angular-devkit/build-angular 0.800.0
@angular-devkit/build-optimizer 0.800.0
@angular-devkit/build-webpack 0.800.0
@angular-devkit/core 8.0.0
@angular-devkit/schematics 8.0.0
@ngtools/webpack 8.0.0
@schematics/angular 8.0.0
@schematics/update 0.800.0
rxjs 6.4.0
typescript 3.4.5
webpack 4.30.0
Anything else relevant?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Using Web Workers - Web APIs - MDN Web Docs
A worker is an object created using a constructor (e.g. Worker() ) that runs a named JavaScript file β this file contains the...
Read more >Understanding and Using Web Workers - CODE Magazine
Miguel Castro teaches you the how to use Web Workers to do multi-threaded development in Web applications using JavaScript.
Read more >Web workers without a separate Javascript file? - Stack Overflow
What if you want to create your worker script on the fly, or create a self-contained page without having to create separate worker...
Read more >Introducing WebSockets - Bringing Sockets to the Web
If the specified file exists, the browser will spawn a new worker thread, which is downloaded asynchronously. The worker will not begin untilΒ ......
Read more >How Web Workers Work in JavaScript β With a Practical JS ...
Whenever you create a web worker application, you generally write a worker file which handles all the complex scenarios that you want the...
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 Free
Top 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

According to https://github.com/GoogleChromeLabs/worker-plugin/issues/24 the workaround for now is:
new Worker('./worker-one', { name: 'one', type: 'module' })This does work for me. Giving unique names to workers doesnβt look like a big deal.Iβm on it! I believe I also have a fix incoming for the incrementing ID issue @filipesilva.