A WebWorker declared in a dependency is not correctly bundled
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:
export function launchWorker() {
console.warn('Example of creating a webworker in a dependency');
const worker = new Worker(new URL('./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: https://github.com/vitejs/vite/issues/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