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
96338c31
Unverified
Commit
96338c31
authored
Apr 13, 2026
by
Tim Neutkens
Committed by
GitHub
Apr 13, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "refactor: write pages router export files directly to server/pages/" (#92733)
Reverts vercel/next.js#90018
parent
a1cb5654
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
166 additions
and
114 deletions
+166
-114
index.ts
packages/next/src/build/index.ts
+147
-76
index.ts
packages/next/src/export/index.ts
+17
-27
pages.ts
packages/next/src/export/routes/pages.ts
+1
-1
index.test.ts
test/integration/dynamic-routing/test/index.test.ts
+1
-1
index.test.ts
test/integration/i18n-support/test/index.test.ts
+0
-9
No files found.
packages/next/src/build/index.ts
View file @
96338c31
This diff is collapsed.
Click to expand it.
packages/next/src/export/index.ts
View file @
96338c31
...
@@ -345,10 +345,8 @@ async function exportAppImpl(
...
@@ -345,10 +345,8 @@ async function exportAppImpl(
)
)
}
}
if
(
!
options
.
buildExport
)
{
await
fs
.
rm
(
outDir
,
{
recursive
:
true
,
force
:
true
})
await
fs
.
rm
(
outDir
,
{
recursive
:
true
,
force
:
true
})
await
fs
.
mkdir
(
join
(
outDir
,
'_next'
,
buildId
),
{
recursive
:
true
})
await
fs
.
mkdir
(
join
(
outDir
,
'_next'
,
buildId
),
{
recursive
:
true
})
}
await
fs
.
writeFile
(
await
fs
.
writeFile
(
join
(
distDir
,
EXPORT_DETAIL
),
join
(
distDir
,
EXPORT_DETAIL
),
...
@@ -652,7 +650,7 @@ async function exportAppImpl(
...
@@ -652,7 +650,7 @@ async function exportAppImpl(
}
}
const
pagesDataDir
=
options
.
buildExport
const
pagesDataDir
=
options
.
buildExport
?
join
(
distDir
,
'server'
,
'pages'
)
?
outDir
:
join
(
outDir
,
'_next/data'
,
buildId
)
:
join
(
outDir
,
'_next/data'
,
buildId
)
const
publicDir
=
join
(
dir
,
CLIENT_PUBLIC_FILES_PATH
)
const
publicDir
=
join
(
dir
,
CLIENT_PUBLIC_FILES_PATH
)
...
@@ -719,9 +717,7 @@ async function exportAppImpl(
...
@@ -719,9 +717,7 @@ async function exportAppImpl(
options
,
options
,
dir
,
dir
,
distDir
,
distDir
,
outDir
:
options
.
buildExport
outDir
,
?
join
(
distDir
,
'server'
,
'pages'
)
:
outDir
,
nextConfig
,
nextConfig
,
cacheHandler
:
nextConfig
.
cacheHandler
,
cacheHandler
:
nextConfig
.
cacheHandler
,
cacheMaxMemorySize
:
nextConfig
.
cacheMaxMemorySize
,
cacheMaxMemorySize
:
nextConfig
.
cacheMaxMemorySize
,
...
@@ -934,25 +930,19 @@ async function exportAppImpl(
...
@@ -934,25 +930,19 @@ async function exportAppImpl(
// realizing the implications.
// realizing the implications.
const
route
=
normalizePagePath
(
unnormalizedRoute
)
const
route
=
normalizePagePath
(
unnormalizedRoute
)
let
orig
:
string
const
pagePath
=
getPagePath
(
pageName
,
distDir
,
undefined
,
isAppPath
)
if
(
isAppPath
)
{
const
distPagesDir
=
join
(
const
pagePath
=
getPagePath
(
pageName
,
distDir
,
undefined
,
isAppPath
)
pagePath
,
const
distPagesDir
=
join
(
// strip leading / and then recurse number of nested dirs
pagePath
,
// to place from base folder
// strip leading / and then recurse number of nested dirs
pageName
// to place from base folder
.
slice
(
1
)
pageName
.
split
(
'/'
)
.
slice
(
1
)
.
map
(()
=>
'..'
)
.
split
(
'/'
)
.
join
(
'/'
)
.
map
(()
=>
'..'
)
)
.
join
(
'/'
)
)
const
orig
=
join
(
distPagesDir
,
route
)
orig
=
join
(
distPagesDir
,
route
)
}
else
{
// Pages router files are written directly to server/pages/
// by the export worker during build, so read from there.
orig
=
join
(
distDir
,
'server'
,
'pages'
,
route
)
}
const
handlerSrc
=
`
${
orig
}
.body`
const
handlerSrc
=
`
${
orig
}
.body`
const
handlerDest
=
join
(
outDir
,
route
)
const
handlerDest
=
join
(
outDir
,
route
)
...
...
packages/next/src/export/routes/pages.ts
View file @
96338c31
...
@@ -113,7 +113,7 @@ export async function exportPagesPage(
...
@@ -113,7 +113,7 @@ export async function exportPagesPage(
renderResult
&&
!
renderResult
.
isNull
?
renderResult
.
toUnchunkedString
()
:
''
renderResult
&&
!
renderResult
.
isNull
?
renderResult
.
toUnchunkedString
()
:
''
const
metadata
=
renderResult
?.
metadata
||
{}
const
metadata
=
renderResult
?.
metadata
||
{}
if
(
metadata
.
pageData
&&
!
ssgNotFound
)
{
if
(
metadata
.
pageData
)
{
const
dataFile
=
join
(
const
dataFile
=
join
(
pagesDataDir
,
pagesDataDir
,
htmlFilename
.
replace
(
/
\.
html$/
,
NEXT_DATA_SUFFIX
)
htmlFilename
.
replace
(
/
\.
html$/
,
NEXT_DATA_SUFFIX
)
...
...
test/integration/dynamic-routing/test/index.test.ts
View file @
96338c31
...
@@ -1543,7 +1543,7 @@ function runTests({ dev }) {
...
@@ -1543,7 +1543,7 @@ function runTests({ dev }) {
"/catchall-dash/[...hello-world]": "pages/catchall-dash/[...hello-world].html",
"/catchall-dash/[...hello-world]": "pages/catchall-dash/[...hello-world].html",
"/d/[id]": "pages/d/[id].html",
"/d/[id]": "pages/d/[id].html",
"/dash/[hello-world]": "pages/dash/[hello-world].html",
"/dash/[hello-world]": "pages/dash/[hello-world].html",
"/index/[...slug]": "pages/index/[...slug].html",
"/index/[...slug]": "pages/index/
index/
[...slug].html",
"/on-mount/[post]": "pages/on-mount/[post].html",
"/on-mount/[post]": "pages/on-mount/[post].html",
"/p1/p2/all-ssg/[...rest]": "pages/p1/p2/all-ssg/[...rest].js",
"/p1/p2/all-ssg/[...rest]": "pages/p1/p2/all-ssg/[...rest].js",
"/p1/p2/all-ssr/[...rest]": "pages/p1/p2/all-ssr/[...rest].js",
"/p1/p2/all-ssr/[...rest]": "pages/p1/p2/all-ssr/[...rest].js",
...
...
test/integration/i18n-support/test/index.test.ts
View file @
96338c31
...
@@ -88,15 +88,6 @@ describe('i18n Support', () => {
...
@@ -88,15 +88,6 @@ describe('i18n Support', () => {
expect
(
content
).
toMatch
(
/Internal Server Error/i
)
expect
(
content
).
toMatch
(
/Internal Server Error/i
)
}
}
})
})
it
(
'should have locale-prefixed pages-manifest entries for default 500'
,
async
()
=>
{
const
manifest
=
await
fs
.
readJSON
(
join
(
appDir
,
'.next/server/pages-manifest.json'
)
)
for
(
const
locale
of
locales
)
{
expect
(
manifest
[
`/
${
locale
}
/500`
]).
toBe
(
`pages/
${
locale
}
/500.html`
)
}
})
}
}
)
)
...
...
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