Skip to content

Commit a95c4c4

Browse files
authored
[next] Make app route prerender filter dynamic route specific (#11863)
Follow-up to #11862 ensuring we only filter for dynamic app routes as those are the only ones we were concerned about specifically and the related test change shouldn't have been necessary.
1 parent da15d30 commit a95c4c4

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

.changeset/warm-carrots-scream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vercel/next': patch
3+
---
4+
5+
Make app route prerender filter dynamic route specific

packages/next/src/server-build.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,14 +1403,20 @@ export async function serverBuild({
14031403

14041404
prerenderRoutes.forEach(route => {
14051405
if (experimentalPPRRoutes.has(route)) return;
1406-
// we can't delete app route lambdas just because
1407-
// they are in the prerender manifest since a dynamic
1408-
// route can have some prerendered paths and the rest SSR
1409-
if (inversedAppPathManifest?.[route]) return;
14101406
if (routesManifest?.i18n) {
14111407
route = normalizeLocalePath(route, routesManifest.i18n.locales).pathname;
14121408
}
14131409

1410+
if (
1411+
// we can't delete dynamic app route lambdas just because
1412+
// they are in the prerender manifest since a dynamic
1413+
// route can have some prerendered paths and the rest SSR
1414+
inversedAppPathManifest[route] &&
1415+
isDynamicRoute(route)
1416+
) {
1417+
return;
1418+
}
1419+
14141420
delete lambdas[
14151421
normalizeIndexOutput(
14161422
path.posix.join('./', entryDirectory, route === '/' ? '/index' : route),

packages/next/test/integration/integration-1.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ if (parseInt(process.versions.node.split('.')[0], 10) >= 16) {
8888
)
8989
).toBeFalsy();
9090

91-
expect(lambdas.size).toBe(7);
91+
expect(lambdas.size).toBe(6);
9292

9393
// RSC, root-level page.js
9494
expect(buildResult.output['index']).toBeDefined();

0 commit comments

Comments
 (0)