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

Warning: Conflict: Multiple assets emit different content to the same filename 0.worker.js #19569

Closed
1 task done
muuvmuuv opened this issue Dec 8, 2020 · 8 comments
Closed
1 task done
Labels
Milestone

Comments

@muuvmuuv
Copy link

muuvmuuv commented Dec 8, 2020

🐞 Bug report

Command (mark with an x)

  • serve

Is this a regression?

No

Description

I have two independent modules which have both their own workers. Now when I serve my app and edit any file inside one module tree it prints Multiple assets emit different content to the same filename 0.worker.js.

🔬 Minimal Reproduction

https://github.com/muuvmuuv/angular-worker-issue

  1. server the app
  2. go into src/app/two/two.page.ts:14
  3. edit the file and save it

🔥 Exception or Error


Warning: Conflict: Multiple assets emit different content to the same filename 0.worker.js
Warning: Conflict: Multiple assets emit different content to the same filename 0.worker.js.map

🌍 Your Environment


Angular CLI: 11.0.3
Node: 14.15.1
OS: darwin x64

Angular: 11.0.3
... cli, common, compiler, compiler-cli, core, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.3
@angular-devkit/build-angular   0.1100.3
@angular-devkit/core            11.0.3
@angular-devkit/schematics      11.0.3
@schematics/angular             11.0.3
@schematics/update              0.1100.3
rxjs                            6.6.3
typescript                      4.0.5

Anything else relevant?

I am using observable-webworker lib to be able to use Observables with workers but also tested without the lib and the error still persist.

@clydin clydin added the needs: investigation Requires some digging to determine if action is needed label Dec 9, 2020
@alan-agius4
Copy link
Collaborator

This is probably due to Webpack 5 usage, which now includes worker bundling and it also requires a different syntax.

@muuvmuuv
Copy link
Author

muuvmuuv commented Dec 9, 2020

I am not using webpack 5. It's just in the repo to test against it. That is why npm is used here in conjunction with npm-force-resolution.

@tedaky
Copy link

tedaky commented Dec 17, 2020

I was able to solve this issue by adding a name to WorkerOptions.
For example in your minimal repo update one.page.ts new Worker('./one.worker.ts', { type: 'module' }) to new Worker('./one.worker.ts', { type: 'module', name: 'worker-one' }) and in two.page.ts new Worker('./two.worker.ts', { type: 'module' }) to new Worker('./two.worker.ts', { type: 'module', name: 'worker-two' })

@muuvmuuv
Copy link
Author

I am on holiday now but will test it in January. Thank you for the hint. Anyway I think Angular should be smart enough ^^

@destus90
Copy link
Contributor

Hasn't the issue been resolved GoogleChromeLabs/worker-plugin#35 ?

@muuvmuuv
Copy link
Author

@destus90 seems like in v3, maybe it got changed later again?

@muuvmuuv
Copy link
Author

Using a name fixed it for me.

@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 May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants