Skip to content

$localize runtime error with special .browserslistrc file #48194

@javiermarinros

Description

@javiermarinros

Which @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: i18nIssues related to localization and internationalization

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions