Skip to content

ng serve fails for localized builds with @angular/build >= 20.3.7 #1070

@chet-gleave

Description

@chet-gleave

With what library do you have an issue?

native-federation

Reproduction of the bug/regression with instructions

Serving builds localized with i18n and @angular/build <= 20.3.6 works fine as shown in the following repository:
https://github.com/chet-gleave/I18N-NG-Serve-NF-Issue

npm run start:shell @angular/build@20.3.6
Image
npm run start:shell:fr @angular/build@20.3.6
Image
npm run start:shell:de @angular/build@20.3.6
Image


I have added a branch to demonstrate the issue:
https://github.com/chet-gleave/I18N-NG-Serve-NF-Issue/tree/Issue-Showcase

The browser console displays the following errors:

Uncaught TypeError: Failed to resolve module specifier "@angular/common/locales/global/fr". Relative references must start with either "/", "./", or "../".

Uncaught TypeError: Failed to resolve module specifier "@angular/common/locales/global/de". Relative references must start with either "/", "./", or "../".

Note that the error happens in between vite connecting:
Image

npm run start:shell @angular/build@20.3.7
Image
npm run start:shell:fr @angular/build@20.3.7
Image
npm run start:shell:de @angular/build@20.3.7
Image

Compatibility Table

Command @angular/build 20.3.6 @angular/build 20.3.7
npm run start:shell
npm run start:shell:fr
npm run start:shell:de

Expected behavior

Localized builds should serve as they were prior to this update to @angular/build

Versions of Native/Module Federation, Angular, Node, Browser, and operating system

Native/Module Federation: @angular-architects/native-federation@20.3.1
Angular: ^20.3
Node: 22.22.0
Browser: Chrome
Operating system(s): Windows 10/11

Other information

Angular Release 20.3.7:
https://github.com/angular/angular-cli/releases/tag/20.3.7

Suspected commit that broke the behavior:
angular/angular-cli@8cdda11

"...
Previously, the angular:locale/data: namespace was left unresolved by the build process for the dev server. This caused Vite to treat the namespace as a new dependency, triggering a pre-bundling step that led to the error.
With this change, esbuild now resolves the angular:locale/data: namespace and replaces it with the direct module import path. ..."

I'm not sure what the fix is for this so I'm marking as unwilling to submit a PR but happy to provide any other details.

Also, it would be really great if there was more documentation around native federation and i18n integration. Even just an example repository would go a long way.

I would be willing to submit a PR to fix this issue

  • Yes
  • No

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