-
Notifications
You must be signed in to change notification settings - Fork 12k
Angular 12 breaks imports in webworkers when using deploy-url #21432
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
Comments
This means that when a relative deployUrl is used it will cause files not to be found because the generated webpack import will include the In this case you should be able to fix this this by using an absolute value Edit: importScripts does respect the document base url, so something else is going on. |
Ah! Thank you for your quick reply @alan-agius4! I see that you edited your comment but for what its worth, making the deploy url absolute in my cases did indeed resolve the issue for me, and it makes sense in hind sight. Frustrating I suppose that it'd behave differently after upgrading. Again, thank you very much for the assist 🙇 ! Would you like me to close this issue, or do you think there is something to investigate further? |
Let’s leave this issue open for the time being. |
@clydin and myself have looked into this and following our investigations this is working as intended. This is because when using |
With this change we deprecate deployUrl which in many case causes unexpected and undesired behaviour. Such as #12322, #21432 and #6666. This is because one of the drawbacks of deploy Url is that this url needs to be injected all over the bundles. This option was previously introduced to handle application that only assets are hosted on a CDN. This setup is now mostly considered as legacy as it is recommended that the entire application is hosted on a CDN. That said, this legacy behaviour can still be achieved by setting the `baseHref` to the CDN address, while setting the `APP_BASE_HREF` to the application address. Closes #12322 and closes #6666
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
compiler-cli, compiler
Is this a regression?
No
Description
Problem
After upgrading to Angular 12 we have a new form of error showing up in the application originating in webworker files. The error reads like:
Note how (in this example) the
worker-demo/en-US
is duplicated.It appears that the source of the issue is from setting
--deploy-url='worker-demo/en-US/'
on the build command. That value is picked up in the webworker by webpack:And then passed to
importScripts
:Resulting in something that looks like:

Reproduction
I've provided a reproduction repo to illustrate the issue.
yarn build
(add--optimization=false
to be able to see unminified code)--deploy-url
we need to move theindex.html
file up to thedist
folder.python -m SimpleHTTPServer 8000
http://0.0.0.0:8000/
The app will bootstrap fine, but when the webworker goes to import the vendor bundle its looking for another
webworker-demo/en-US
folder.Please provide a link to a minimal reproduction of the bug
https://github.com/philmayfield/worker-demo
Please provide the exception or error you saw
Please provide the environment you discovered this bug in
Anything else?
Its very possible we've got a flaw in our setup, buuuut it was working in Angular 11 🤷
The text was updated successfully, but these errors were encountered: