Skip to content

Commit b149c61

Browse files
committed
fix(@angular-devkit/build-angular): pre-transform error when using vite with SSR
This commit fixes a regression which causes a pre-transform error when using vite with ssr. The `request.url` is now passed to the index transformer instead of `request.originalUrl`. This is because the `request.url` will have a value of the `index.html`. Closes angular#26897
1 parent fffc9e1 commit b149c61

File tree

1 file changed

+2
-1
lines changed
  • packages/angular_devkit/build_angular/src/builders/dev-server

1 file changed

+2
-1
lines changed

packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ export async function setupServer(
668668
) {
669669
const url = req.originalUrl;
670670
if (
671+
!req.url ||
671672
// Skip if path is not defined.
672673
!url ||
673674
// Skip if path is like a file.
@@ -686,7 +687,7 @@ export async function setupServer(
686687
return;
687688
}
688689

689-
transformIndexHtmlAndAddHeaders(url, rawHtml, res, next, async (html) => {
690+
transformIndexHtmlAndAddHeaders(req.url, rawHtml, res, next, async (html) => {
690691
const { content } = await renderPage({
691692
document: html,
692693
route: new URL(req.originalUrl ?? '/', server.resolvedUrls?.local[0]).toString(),

0 commit comments

Comments
 (0)