Skip to content

SSR + Internationalization + pre-rendered routes does not return pre-rendered pages #27196

Closed
@timothyBrake

Description

@timothyBrake

Which @angular/* package(s) are the source of the bug?

language-service, platform-server

Is this a regression?

Yes

Description

When adding SSR and Internationalization to a project, the pre-rendered routes are not served.

Most basic example with preconfigured ssr + localize + prerender: https://github.com/lostium/ssr-i18n-angular17
But this is also visible with a clean Angular CLI project adding SSR + localize + Prerender

  1. Clean git clone of this project https://github.com/lostium/ssr-i18n-angular17
  2. Build the project
  3. Then manually update dist/ssr-i18n-angular17/browser/en/page-1/index.html and add text This is pre-rendered
  4. Start proxy server
  5. Open Chrome and make sure using DevTools > Network > Disable Cache is checked
  6. Using browser navigate to http://localhost:4000/en/page-1
  7. Should show the This is pre-rendered but it is NOT showing that page
  8. Using browser navigate to http://localhost:4000/en/page-1/index.html DOES show the pre-rendered page

Somewhere along the way Angular isn't serving the pre-rendered page when navigating to http://localhost:4000/en/page-1

To be clear: everything works as expected excluding Internationalisation and step 6 without the i18n does work http://localhost:4000/page-1 so its only after adding i18n that the pre-rendered page isn't being served.

Please provide a link to a minimal reproduction of the bug

https://github.com/lostium/ssr-i18n-angular17

Please provide the exception or error you saw

After manually updating the dist/ssr-i18n-angular17/browser/en/page-1/index.html page and starting the server and you navigate to _http://localhost:4000/en/page-1_ that pre-rendered page isn't being served.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.2.2
Node: 20.11.1
Package Manager: npm 10.2.4
OS: darwin arm64

Angular: 17.2.3
... animations, common, core, forms, platform-browser
... platform-browser-dynamic, platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.2
@angular-devkit/build-angular   17.2.2
@angular-devkit/core            17.2.2
@angular-devkit/schematics      17.2.2
@angular/cli                    17.2.2
@angular/compiler               17.0.8
@angular/compiler-cli           17.0.8
@angular/localize               17.0.8
@angular/ssr                    17.2.2
@schematics/angular             17.2.2
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.4

Anything else?

The combination of SSR and Internationalisation isn't well documented and the ng update, ng add doesn't change the code to make it work together. Developers now have to go outside the official Angular documentation to make it work.
Would be great as well that the official Angular documentation has a working version of all these feature combined together with complete code of a most basic & running example: SSR + Internationalisation + Pre-render.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions