You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That project just imports in main.component.ts the next function from a dependency:
exportfunctionlaunchWorker(){console.warn('Example of creating a webworker in a dependency');constworker=newWorker(newURL('./x.worker',import.meta.url),{type: 'module'});worker.postMessage('foo');}
If that code is included in the app itself it works as expected but when it is declared in a dependency it fails.
Afaik, in the dev server is not working because vite does not support this yet. More info including workarounds in this issue: vitejs/vite#11672
But my main concern here is the production build because I suspect that is a problem in the angular build system itself and I wasn't able to find any workaround for this.
Describe the solution you'd like
Correctly bundle Web Workers declared in a dependency.
Describe alternatives you've considered
No response
The text was updated successfully, but these errors were encountered:
Thanks for reporting this issue. Luckily, it has already been fixed in one of the recent releases. Please update to the most recent version to resolve the problem.
If the problem persists in your application after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. You can use ng new repro-app to create a new project where you reproduce the problem.
Command
build
Description
If a library that uses a Web Worker is used, the angular bundle generation is not including the worker file.
I made a mimimal reproduction case here: https://github.com/andsouto/angular-webworker-example
That project just imports in
main.component.ts
the next function from a dependency:If that code is included in the app itself it works as expected but when it is declared in a dependency it fails.
Afaik, in the dev server is not working because vite does not support this yet. More info including workarounds in this issue: vitejs/vite#11672
But my main concern here is the production build because I suspect that is a problem in the angular build system itself and I wasn't able to find any workaround for this.
Describe the solution you'd like
Correctly bundle Web Workers declared in a dependency.
Describe alternatives you've considered
No response
The text was updated successfully, but these errors were encountered: