Skip to content
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

Different web workers in the application refer to the one file #14582

Closed
destus90 opened this issue May 30, 2019 · 13 comments · Fixed by GoogleChromeLabs/worker-plugin#35 or #15456
Closed

Comments

@destus90
Copy link
Contributor

🐞 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?

@filipesilva
Copy link
Contributor

@developit this seems to be a bug, do you know what's happening? They should be different bundles because they are from different paths.

@filipesilva
Copy link
Contributor

Yeah this seems to be GoogleChromeLabs/worker-plugin#24. We're blocked waiting on a fix for it.

@developit
Copy link
Contributor

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

@filipesilva
Copy link
Contributor

Sweet :D

@markgolding
Copy link

Hi any idea when this fix will get in release

@developit
Copy link
Contributor

None yet, sorry @markgolding!

@markgolding
Copy link

found a workaround for this if you run with "ng serve --prod" then the hashes are added to end of worker names so all works ok.

@destus90
Copy link
Contributor Author

@markgolding
Indeed, this works. But it is not good running the app with the --prod flag every time, because Terser is realy slow for a large project.

@SteveVanOpstal
Copy link

@destus90 @markgolding
No need to serve in production, you can add "outputHashing": "all" to your development configuration in angular.json (or if you don't have that build > options).
Be sure to remove it after this bug is fixed though.

@alan-agius4 alan-agius4 modified the milestones: 8.0.x, 8.1.x Jul 2, 2019
@markgolding
Copy link

Cheers @SteveVanOpstal saved me hours of staring a console waiting for rebuilds.

@rt-gavrilov
Copy link

According to
GoogleChromeLabs/worker-plugin#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.

@developit
Copy link
Contributor

Worker Plugin 3.2.0 has been published and includes a fix for this.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.