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