Skip to content

Commit c497749

Browse files
alan-agius4clydin
authored andcommitted
fix(@angular/build): prevent errors with parameterized routes when getPrerenderParams is undefined
Ensure that parameterized routes do not cause errors when the `getPrerenderParams` function is undefined, specifically in cases where the routing API is not utilized. Closes #28948 (cherry picked from commit c685c70)
1 parent d8cbf3b commit c497749

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/angular/build/src/utils/server-rendering/routes-extractor-worker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function extractRoutes(): Promise<RoutersExtractorWorkerResult> {
3838
const { routeTree, appShellRoute, errors } = await extractRoutesAndCreateRouteTree(
3939
serverURL,
4040
undefined /** manifest */,
41-
true /** invokeGetPrerenderParams */,
41+
outputMode !== undefined /** invokeGetPrerenderParams */,
4242
outputMode === OutputMode.Server /** includePrerenderFallbackRoutes */,
4343
);
4444

tests/legacy-cli/e2e/tests/build/prerender/discover-routes-standalone.ts

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ export default async function () {
5959
path: 'lazy-two',
6060
loadComponent: () => import('./lazy-two/lazy-two.component').then(c => c.LazyTwoComponent),
6161
},
62+
{
63+
path: ':param',
64+
component: OneComponent,
65+
},
6266
];
6367
`,
6468
);

0 commit comments

Comments
 (0)