Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ export async function prerenderPages(
const serializableRouteTreeNodeForPrerender: WritableSerializableRouteTreeNode = [];
for (const metadata of serializableRouteTreeNode) {
if (outputMode !== OutputMode.Static && metadata.redirectTo) {
// Skip redirects if output mode is not static.
continue;
}

if (metadata.route.includes('*')) {
// Skip catch all routes from prerender.
continue;
}

Expand All @@ -129,7 +135,6 @@ export async function prerenderPages(
case RouteRenderMode.Prerender:
case RouteRenderMode.AppShell:
serializableRouteTreeNodeForPrerender.push(metadata);

break;
case RouteRenderMode.Server:
if (outputMode === OutputMode.Static) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from 'node:path';
import { expectFileToMatch, replaceInFile, writeFile } from '../../utils/fs';
import { expectFileNotToExist, expectFileToMatch, replaceInFile, writeFile } from '../../utils/fs';
import { noSilentNg, silentNg } from '../../utils/process';
import { setupProjectWithSSRAppEngine } from './setup';
import { existsSync } from 'node:fs';
Expand Down Expand Up @@ -36,6 +36,10 @@ export default async function () {
path: 'ssg/:id',
component: SsgWithParamsComponent,
},
{
path: '**',
component: HomeComponent,
},
];
`,
);
Expand Down Expand Up @@ -100,4 +104,7 @@ export default async function () {
!existsSync('dist/test-project/server'),
'Server directory should not exist when output-mode is static',
);

// Should not prerender the catch all
await expectFileNotToExist(join('dist/test-project/browser/**/index.html'));
}