Description
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
I have an application where English is the default locale and I don't want the prefix '/en' in the URL. With CommonEngine it was possible to set the baseHref in angular.json to '/' to achieve this.
"i18n": {
"sourceLocale": {
"code": "en",
"baseHref": "/"
},
"locales": {
"de": "src/messages/messages.de.xlf",
"es": "src/messages/messages.es.xlf"
}
}
Now I have migrated this application to Angular 19 and noticed that this does not seem to be possible anymore with AngularNodeAppEngine as the default locale 'en' is not recognized. The build is successful and all other locales work fine, except 'en'. Even the root path works, because the potentialLocale is '' (empty string) in this case, but no child routes can be found (at least not with ssr). Is this behavior expected? If so, are there still any workarounds to disable the locale prefix for a specific locale?
In a (maybe) naive approach, I tried adding the following line just before returning the entryPointExport in app-engine.ts#L146 and it worked, so it seems to be supported everywhere except in this particular location and therefore I really hope it's just a bug and I don't have to revert the migration.
if (!entryPoints.has(potentialLocale) && entryPoints.has("")) {
return this.getEntryPointExports("");
}
Any help is appreciated, because everything else is already migrated.
Minimal Reproduction
Repo: https://github.com/eufri/angular-ssr-issue
Basically I have created a new app
ng new angular-ssr-issue --ssr --minimal --package-manager=yarn --routing --server-routing --skip-tests --ssr
Added localize package
ng add @angular/localize
And then added some test locales + messages and a child component +route
Exception or Error
Your Environment
Angular: 19.0.0
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1900.1
@angular-devkit/build-angular 19.0.1
@angular-devkit/core 19.0.1
@angular-devkit/schematics 19.0.1
@angular/cli 19.0.1
@angular/ssr 19.0.1
@schematics/angular 19.0.1
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0
Anything else relevant?
No response