Skip to content

$localize in library not working with esbuild #28576

@gongAll

Description

@gongAll

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When I use $localize in a library and use it as a dependency on my app, it works fine when I build the app with @angular-devkit/build-angular:browser however when I switch it to @angular-devkit/build-angular:browser-esbuild it suddenly throws the following runtime error, which prevents the app from properly loading:

Uncaught TypeError: $localize is not a function.

Do you have any idea of what I might be doing wrong?

Minimal Reproduction

I can surely provide more info, if need be.

Exception or Error

No response

Your Environment

Angular CLI: 18.2.7
Node: 20.14.0
Package Manager: yarn 1.22.22
OS: linux x64

Angular: 18.2.7
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, localize, platform-browser, platform-browser-dynamic
... pwa, router, service-worker

Package Version

@angular-devkit/architect 0.1802.7
@angular-devkit/build-angular 18.2.7
@angular-devkit/core 18.2.7
@angular-devkit/schematics 18.2.7
@schematics/angular 18.2.7
rxjs 7.8.1
typescript 5.5.4
zone.js 0.15.0

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions