Skip to content

Commit 0b0df5a

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 #26897
1 parent 14b1be2 commit 0b0df5a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/angular_devkit/build_angular/src/tools/vite/angular-memory-plugin.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export function createAngularMemoryPlugin(options: AngularMemoryPluginOptions):
176176
) {
177177
const url = req.originalUrl;
178178
if (
179+
!req.url ||
179180
// Skip if path is not defined.
180181
!url ||
181182
// Skip if path is like a file.
@@ -194,7 +195,7 @@ export function createAngularMemoryPlugin(options: AngularMemoryPluginOptions):
194195
return;
195196
}
196197

197-
transformIndexHtmlAndAddHeaders(url, rawHtml, res, next, async (html) => {
198+
transformIndexHtmlAndAddHeaders(req.url, rawHtml, res, next, async (html) => {
198199
const { content } = await renderPage({
199200
document: html,
200201
route: new URL(req.originalUrl ?? '/', server.resolvedUrls?.local[0]).toString(),

0 commit comments

Comments
 (0)