Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is likely due to a security feature called "Same-Origin Policy" that prevents scripts loaded from one origin to access resources from a different origin. When using a Worker() constructor, the script file for the worker is loaded as a separate origin, which can cause issues when using Angular with Webpack.

To fix this issue, you can configure Webpack to bundle the worker script file as an inline blob, rather than a separate file. This can be done using the "worker-loader" plugin, which allows you to import a worker script file as a module and have it bundled by Webpack.

Alternatively, you can also host the worker script file on the same origin as the main script file, which will allow it to be loaded without triggering the Same-Origin Policy error.