Skip to content

Wrong path to prerendered html page with APP_BASE_HREF set #28775

@json-derulo

Description

@json-derulo

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

v18

Description

In an Angular 19 SSR + i18n project, I am setting a base href in my app config:

{
    provide: APP_BASE_HREF,
    useValue: '/'
  }

However, in the path to my prerendered html page parts are being removed.

Minimal Reproduction

Repro: https://github.com/json-derulo/ng19-prerendering-path-issue-repro

  • Generate a fresh Angular 19 project
  • Add i18n
  • Add the above snippet to the app config
  • Add routing
  • Build the project with ng build

Exception or Error

There is no error. However on prerender during the build, parts from the router paths are being removed. For example, I have defined speakers/xyz in my router. But the path to the respective html file in the dist folder is like the following: en-US/ers/xyz/index.html. Expected behavior would be en-US/speakers/xyz/index.html.

Your Environment

Angular CLI: 19.0.0-rc.0
Node: 22.11.0
Package Manager: npm 10.9.0
OS: darwin x64

Angular: 19.0.0-rc.0
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router, ssr

Package Version

@angular-devkit/architect 0.1900.0-rc.0
@angular-devkit/build-angular 19.0.0-rc.0
@angular-devkit/core 19.0.0-rc.0 (cli-only)
@angular-devkit/schematics 19.0.0-rc.0
@schematics/angular 19.0.0-rc.0
rxjs 7.8.1
typescript 5.5.4
zone.js 0.15.0

Anything else relevant?

In Angular v18 the issue is not reproducible.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions