$localize runtime error with special .browserslistrc file
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
localize
Is this a regression?
Yes
Description
Since Angular 15, targeting last 5 iOS major versions using .browserslistrc
file breaks the generated bundle, throwing TypeError: $localize is not a function
on runtime.
Just changing .browserslistrc
to last 4 iOS major versions
generates valid bundles again.
To reproduce, follow this steps:
ng new ng add @angular/localize
Then update .browserslistrc
with this content: last 5 iOS major versions
Add "localize": true
in your angular.json
file, under projects > yourProject > architect > build > options.
Add an i18n
attribute to some HTML element to enable localization.
And then:
ng serve
Please provide a link to a minimal reproduction of the bug
I haven’t been able to reproduce on StackBlitz, it’s ignoring my angular.json file
Please provide the exception or error you saw
TypeError: $localize is not a function
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 15.0.0
Node: 18.12.1
Package Manager: npm 9.1.2
OS: win32 x64
Angular: 15.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1500.0
@angular-devkit/build-angular 15.0.0
@angular-devkit/core 15.0.0
@angular-devkit/schematics 15.0.0
@schematics/angular 15.0.0
rxjs 7.5.7
typescript 4.8.4
Anything else?
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
$localize is not a function with Angular 14 build #4346 - GitHub
It works on my PC (development), but throws an error on the server (production, at runtime on some pages of my application. Could...
Read more >Browser support - Angular
The polyfills options of the browser and test builder can be a full path for a file (Example: src/polyfills.ts ) or, relative to...
Read more >Angular 10 in depth - JavaScript in Plain English
New default browser configuration. Web browsers move faster than ever. Angular follows course and now uses an updated browserslist file (.browserslistrc). As ...
Read more >an error was thrown in afterall angular 12 - You.com | The AI ...
I had the same problem, and fixed it by downgrading my ts-loader and ts-node to the versions used in the ionic-unit-testing-example repository.
Read more >How do I support Internet Explorer in an Angular 8 application?
According to this issue reply. You need to follow the following steps. Create a new tsconfig tsconfig.es5.json next to tsconfig.json with ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any updates on this issue? I face the exact same problem since upgrading from Angular 14 to 15. Thanks!
It looks like the $localize is not being replaced when the component output is as follows:
Transferring back to the FW as this is not a CLI issue.