Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
686ba5bd
Unverified
Commit
686ba5bd
authored
Aug 07, 2025
by
Jiachi Liu
Committed by
GitHub
Aug 07, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: static not-found missing in prerender manifest (#82199)
parent
0b2c3b15
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
9 deletions
+39
-9
index.ts
packages/next/src/build/index.ts
+6
-9
index.ts
packages/next/src/export/index.ts
+4
-0
app-static.test.ts
test/e2e/app-dir/app-static/app-static.test.ts
+25
-0
cache-components-dynamic-imports.test.ts
...-dynamic-imports/cache-components-dynamic-imports.test.ts
+1
-0
metadata-static-generation.test.ts
...data-static-generation/metadata-static-generation.test.ts
+1
-0
metadata-streaming-static-generation.test.ts
...c-generation/metadata-streaming-static-generation.test.ts
+1
-0
use-cache.test.ts
test/e2e/app-dir/use-cache/use-cache.test.ts
+1
-0
No files found.
packages/next/src/build/index.ts
View file @
686ba5bd
...
@@ -76,8 +76,8 @@ import {
...
@@ -76,8 +76,8 @@ import {
MIDDLEWARE_REACT_LOADABLE_MANIFEST
,
MIDDLEWARE_REACT_LOADABLE_MANIFEST
,
SERVER_REFERENCE_MANIFEST
,
SERVER_REFERENCE_MANIFEST
,
FUNCTIONS_CONFIG_MANIFEST
,
FUNCTIONS_CONFIG_MANIFEST
,
UNDERSCORE_NOT_FOUND_ROUTE_ENTRY
,
UNDERSCORE_NOT_FOUND_ROUTE
,
UNDERSCORE_NOT_FOUND_ROUTE
,
UNDERSCORE_NOT_FOUND_ROUTE_ENTRY
,
DYNAMIC_CSS_MANIFEST
,
DYNAMIC_CSS_MANIFEST
,
TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST
,
TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST
,
}
from
'../shared/lib/constants'
}
from
'../shared/lib/constants'
...
@@ -3090,12 +3090,6 @@ export default async function build(
...
@@ -3090,12 +3090,6 @@ export default async function build(
]
]
for
(
const
prerenderedRoute
of
prerenderedRoutes
)
{
for
(
const
prerenderedRoute
of
prerenderedRoutes
)
{
// TODO: check if still needed?
// Exclude the /_not-found route.
if
(
prerenderedRoute
.
pathname
===
UNDERSCORE_NOT_FOUND_ROUTE
)
{
continue
}
if
(
if
(
isRoutePPREnabled
&&
isRoutePPREnabled
&&
prerenderedRoute
.
fallbackRouteParams
&&
prerenderedRoute
.
fallbackRouteParams
&&
...
@@ -3114,7 +3108,6 @@ export default async function build(
...
@@ -3114,7 +3108,6 @@ export default async function build(
// Handle all the static routes.
// Handle all the static routes.
for
(
const
route
of
staticPrerenderedRoutes
)
{
for
(
const
route
of
staticPrerenderedRoutes
)
{
if
(
isDynamicRoute
(
page
)
&&
route
.
pathname
===
page
)
continue
if
(
isDynamicRoute
(
page
)
&&
route
.
pathname
===
page
)
continue
if
(
route
.
pathname
===
UNDERSCORE_NOT_FOUND_ROUTE
)
continue
const
{
const
{
metadata
=
{},
metadata
=
{},
...
@@ -3164,9 +3157,13 @@ export default async function build(
...
@@ -3164,9 +3157,13 @@ export default async function build(
}
}
const
meta
=
collectMeta
(
metadata
)
const
meta
=
collectMeta
(
metadata
)
const
status
=
route
.
pathname
===
UNDERSCORE_NOT_FOUND_ROUTE
?
404
:
meta
.
status
prerenderManifest
.
routes
[
route
.
pathname
]
=
{
prerenderManifest
.
routes
[
route
.
pathname
]
=
{
initialStatus
:
meta
.
status
,
initialStatus
:
status
,
initialHeaders
:
meta
.
headers
,
initialHeaders
:
meta
.
headers
,
renderingMode
:
isAppPPREnabled
renderingMode
:
isAppPPREnabled
?
isRoutePPREnabled
?
isRoutePPREnabled
...
...
packages/next/src/export/index.ts
View file @
686ba5bd
...
@@ -763,6 +763,10 @@ async function exportAppImpl(
...
@@ -763,6 +763,10 @@ async function exportAppImpl(
if
(
!
options
.
buildExport
&&
prerenderManifest
)
{
if
(
!
options
.
buildExport
&&
prerenderManifest
)
{
await
Promise
.
all
(
await
Promise
.
all
(
Object
.
keys
(
prerenderManifest
.
routes
).
map
(
async
(
unnormalizedRoute
)
=>
{
Object
.
keys
(
prerenderManifest
.
routes
).
map
(
async
(
unnormalizedRoute
)
=>
{
// Skip handling /_not-found route, it will copy the 404.html file later
if
(
unnormalizedRoute
===
'/_not-found'
)
{
return
}
const
{
srcRoute
}
=
prerenderManifest
!
.
routes
[
unnormalizedRoute
]
const
{
srcRoute
}
=
prerenderManifest
!
.
routes
[
unnormalizedRoute
]
const
appPageName
=
mapAppRouteToPage
.
get
(
srcRoute
||
''
)
const
appPageName
=
mapAppRouteToPage
.
get
(
srcRoute
||
''
)
const
pageName
=
appPageName
||
srcRoute
||
unnormalizedRoute
const
pageName
=
appPageName
||
srcRoute
||
unnormalizedRoute
...
...
test/e2e/app-dir/app-static/app-static.test.ts
View file @
686ba5bd
...
@@ -987,6 +987,31 @@ describe('app-dir static/dynamic handling', () => {
...
@@ -987,6 +987,31 @@ describe('app-dir static/dynamic handling', () => {
"initialRevalidateSeconds": false,
"initialRevalidateSeconds": false,
"srcRoute": "/",
"srcRoute": "/",
},
},
"/_not-found": {
"allowHeader": [
"host",
"x-matched-path",
"x-prerender-revalidate",
"x-prerender-revalidate-if-generated",
"x-next-revalidated-tags",
"x-next-revalidate-tag-token",
],
"dataRoute": "/_not-found.rsc",
"experimentalBypassFor": [
{
"key": "next-action",
"type": "header",
},
{
"key": "content-type",
"type": "header",
"value": "multipart/form-data;.*",
},
],
"initialRevalidateSeconds": false,
"initialStatus": 404,
"srcRoute": "/_not-found",
},
"/api/large-data": {
"/api/large-data": {
"allowHeader": [
"allowHeader": [
"host",
"host",
...
...
test/e2e/app-dir/cache-components-dynamic-imports/cache-components-dynamic-imports.test.ts
View file @
686ba5bd
...
@@ -39,6 +39,7 @@ describe('async imports in cacheComponents', () => {
...
@@ -39,6 +39,7 @@ describe('async imports in cacheComponents', () => {
expect
(
prerenderedRoutes
).
toMatchInlineSnapshot
(
`
expect
(
prerenderedRoutes
).
toMatchInlineSnapshot
(
`
[
[
"/_not-found",
"/inside-render/client/async-module",
"/inside-render/client/async-module",
"/inside-render/client/sync-module",
"/inside-render/client/sync-module",
"/inside-render/route-handler/async-module",
"/inside-render/route-handler/async-module",
...
...
test/e2e/app-dir/metadata-static-generation/metadata-static-generation.test.ts
View file @
686ba5bd
...
@@ -24,6 +24,7 @@ const isPPREnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
...
@@ -24,6 +24,7 @@ const isPPREnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
const
staticRoutes
=
prerenderManifest
.
routes
const
staticRoutes
=
prerenderManifest
.
routes
expect
(
Object
.
keys
(
staticRoutes
).
sort
()).
toEqual
([
expect
(
Object
.
keys
(
staticRoutes
).
sort
()).
toEqual
([
'/'
,
'/'
,
'/_not-found'
,
'/suspenseful/static'
,
'/suspenseful/static'
,
])
])
})
})
...
...
test/e2e/app-dir/metadata-streaming-static-generation/metadata-streaming-static-generation.test.ts
View file @
686ba5bd
...
@@ -22,6 +22,7 @@ const isPPREnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
...
@@ -22,6 +22,7 @@ const isPPREnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
const
staticRoutes
=
prerenderManifest
.
routes
const
staticRoutes
=
prerenderManifest
.
routes
expect
(
Object
.
keys
(
staticRoutes
).
sort
()).
toEqual
([
expect
(
Object
.
keys
(
staticRoutes
).
sort
()).
toEqual
([
'/'
,
'/'
,
'/_not-found'
,
'/slow/static'
,
'/slow/static'
,
'/suspenseful/static'
,
'/suspenseful/static'
,
])
])
...
...
test/e2e/app-dir/use-cache/use-cache.test.ts
View file @
686ba5bd
...
@@ -473,6 +473,7 @@ describe('use-cache', () => {
...
@@ -473,6 +473,7 @@ describe('use-cache', () => {
expect
(
prerenderedRouteKeys
).
toEqual
(
expect
(
prerenderedRouteKeys
).
toEqual
(
[
[
'/_not-found'
,
// [id] route, first entry in generateStaticParams
// [id] route, first entry in generateStaticParams
expect
.
stringMatching
(
/
\/
a
\d
/
),
expect
.
stringMatching
(
/
\/
a
\d
/
),
withCacheComponents
&&
'/api'
,
withCacheComponents
&&
'/api'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment