Skip to content

Commit 8178c23

Browse files
committedOct 26, 2023
fix(@angular-devkit/build-angular): handle HTTP requests to assets during SSG in dev-server
This commit fixes an issue were during SSG/SSR in the dev-server http requests to assets causes the page rendering to fail.
1 parent 4bc6deb commit 8178c23

File tree

1 file changed

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

1 file changed

+3
-1
lines changed
 

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,11 @@ export async function setupServer(
540540
}
541541

542542
transformIndexHtmlAndAddHeaders(url, rawHtml, res, next, async (html) => {
543+
const protocol = serverOptions.ssl ? 'https' : 'http';
544+
const route = `${protocol}://${req.headers.host}${req.originalUrl}`;
543545
const { content } = await renderPage({
544546
document: html,
545-
route: pathnameWithoutServePath(url, serverOptions),
547+
route,
546548
serverContext: 'ssr',
547549
loadBundle: (path: string) =>
548550
// eslint-disable-next-line @typescript-eslint/no-explicit-any

0 commit comments

Comments
 (0)