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
webpack import(@angular/common/locales/${mylocale}
) not working
#22088
Comments
I'm facing the same issue |
This answer helped me highlightjs/highlight.js#3223 (comment) |
It helped me too. |
It's important to point out that using Webpack specific features such as magic comments above are not supported by the Angular tooling team. The fact that the Angular CLI is using Webpack is an implementation detail which can change in the future. |
this for me doesn't work...
then yes it compiles, but i got a warning: and also the locale files are not generated (no output for the angular locales) if i do this: import( which other say you now should do, that also doesn't work because yes then the files are generated but the actual import at runtime doesn't work... as you can see the import askes for "./nl.js" but the map doesn't have that there is a "./global/" in front of it. so it doesn't map and can't load it.. So how can i get this working? or is this just not possible right now and i need to postpone the angular 13 upgrade? |
Worked around that: import( so i really need to take them directly from the global dir itself, then the "/global/" prefix is gone. |
it seems that we blame a WebPack bug right? import( are still working like a charm? |
Here is what is currently working for me with v13. I use this in a library and I can verify that the consuming applications of this library are getting the appropriate locale files built. I only want certain locals included.
|
Is there any chance this will be fixed with one of the next releases? Our team also has to postpone angular13 migration due to this. None of the above workarounds seem to get the job done for us. |
@adampasc, this issue is not caused by Angular, but rather it’s a Webpack bug. Please see: webpack/webpack#13865 |
i find this comment really weird return import( for Uppy: import( also for CKEditor but that works a bit different and all those still are working fine, no need to change anything, its purely the angular locales that with the upgrade to 13 that are suddenly not working in the above way anymore. |
This is because dynamic imports don't work in Webpack when an Example "exports": {
"./locales/global/*": {
"default": "./locales/global/*.js"
},
"./locales/*": {
"default": "./locales/*.mjs"
}, |
This approach worked for me: |
Closing since this is not actionable from our end as this is a Webpack bug. Please see: webpack/webpack#13865 |
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?
common
Is this a regression?
Yes
Description
We load our locales dynamically using a dynamic import and
registerLocaleData
this works in angular 12
The Problem
I found the root cause and it's not a angular problem, but a webpack one
webpack/webpack#13865
But I though someone else might get stuck on the same thing, so I would add it as a regression.
Workaround
A workaround is to use a relative or absolute path to the node_modules folder instead
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: