Skip to content

Commit ae1562d

Browse files
authored
fix non static check for not-found route in Next.js 14.2 (#7012)
1 parent 26b8393 commit ae1562d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- fix non static check for not-found route in Next.js 14.2 (#7012)

src/frameworks/next/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ export async function build(
253253
dynamicRoutes,
254254
);
255255

256-
if (
257-
unrenderedServerComponents.has("/_not-found") &&
258-
(await hasStaticAppNotFoundComponent(dir, distDir))
259-
) {
260-
unrenderedServerComponents.delete("/_not-found");
256+
const notFoundPageKey = ["/_not-found", "/_not-found/page"].find((key) =>
257+
unrenderedServerComponents.has(key),
258+
);
259+
if (notFoundPageKey && (await hasStaticAppNotFoundComponent(dir, distDir))) {
260+
unrenderedServerComponents.delete(notFoundPageKey);
261261
}
262262

263263
for (const key of unrenderedServerComponents) {

0 commit comments

Comments
 (0)