daniel-sc / ng-extract-i18n-merge

Extract and merge i18n xliff translation files for angular projects.
MIT License
179 stars 19 forks source link

$localize in library not working with esbuild #116

Closed gongAll closed 1 month ago

gongAll commented 1 month ago

originally on https://github.com/angular/angular-cli/issues/28576

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.

Minimal repro: https://github.com/gongAll/angular-cli-28576

daniel-sc commented 1 month ago

I'll look into this asap

daniel-sc commented 1 month ago

@gongAll I looked into your reproduction and could reproduce the error.

This is not releated to this library (the same error happens when you remove ng-extract-i18n-merge and use the default angular builder for i18n).

I suspect some configuration with the lib or the app is not correct. To resolve this, I'd suggest you reopen https://github.com/angular/angular-cli/issues/28576

gongAll commented 1 month ago

@daniel-sc

Well that makes no sense since I used their builder and the error would not happen. Would you mind supplying a repro to show them? You can fork mine to save time.

Only could reproduce it with your library, which tells me that it could be due to the need of updating the dependencies you have from angular.

daniel-sc commented 1 month ago

Ok, I'll fork your repo for a reproduction without this lib

gongAll commented 1 month ago

Thanks, I appreciate your efforts.

Will follow up closely, cheers

@daniel-sc

daniel-sc commented 1 month ago

@gongAll I removed the lib from your repository and did a clean build and still get the same error - see https://github.com/gongAll/angular-cli-28576/pull/1

gongAll commented 1 month ago

Ok, will check it as soon as possible,

Cheers.