Skip to content

WIP: spike - vite dev server for SSR#21122

Open
Platonn wants to merge 1 commit intorelease/221121.7.xfrom
spike/vite-dev-server-ssr
Open

WIP: spike - vite dev server for SSR#21122
Platonn wants to merge 1 commit intorelease/221121.7.xfrom
spike/vite-dev-server-ssr

Conversation

@Platonn
Copy link
Contributor

@Platonn Platonn commented Feb 4, 2026

Working PoC of vite dev server with SSR:

  • removed noSsr from target "serve" in storefrontapp/project.json
  • to make it work I neeed to make following changes:
    • ngExpressEngine now uses AngularNodeAppEngine instead of CommonEngine
    • server.ts now calls ngExpressEngine directly as a function instead of via Express' res.render() method
    • removed import 'zone.js/plugins/zone-error' from environment.ts (as it caused errors; and this code seems not needed anyway)

How to run
SERVER_REQUEST_ORIGIN=http://localhost:4200 NODE_TLS_REJECT_UNAUTHORIZED=0 npm run start

Caveats:

  • standardized SSR logging is disabled (i.e. we use default LoggerService with console.log) because I could not pass extra providers (with EXPRESS_SERVER_LOGGER) from Express to AngularNodeAppEngine
  • REQUEST and RESPONSE injection tokens are not provided, because I could not pass extra providers from Express to Angular AngularNodeAppEngine
  • CSR fallback is mocked - returning dummy html instead of real CSR shell app html, because I couldn't read physical file from virtual vite's files folder
  • prod build compiles (SERVER_REQUEST_ORIGIN=http://localhost:4200 NODE_TLS_REJECT_UNAUTHORIZED=0 npm run start)
    • but then serving this app fails with angular error in console NG05104

Next steps:

  • try adding outputMode: server in storefrontapp/project.json for the target build and then fixing build issues
  • addressing caveats

@Platonn Platonn requested a review from a team as a code owner February 4, 2026 19:03
@Platonn Platonn changed the title spike: vite dev server for SSR WIP: spike - vite dev server for SSR Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments