Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): pre-transform error when using vi…
Browse files Browse the repository at this point in the history
…te 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

(cherry picked from commit 0b0df5a)
  • Loading branch information
alan-agius4 committed Jan 22, 2024
1 parent 18879eb commit 412fe6e
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -176,6 +176,7 @@ export function createAngularMemoryPlugin(options: AngularMemoryPluginOptions):
) {
const url = req.originalUrl;
if (
!req.url ||
// Skip if path is not defined.
!url ||
// Skip if path is like a file.
Expand All @@ -194,7 +195,7 @@ export function createAngularMemoryPlugin(options: AngularMemoryPluginOptions):
return;
}

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

0 comments on commit 412fe6e

Please sign in to comment.