question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
rt-gavrilovcommented, Jul 8, 2019

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.

2reactions
developitcommented, May 30, 2019

I’m on it! I believe I also have a fix incoming for the incrementing ID issue @filipesilva.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found