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
9561de0e
Unverified
Commit
9561de0e
authored
Aug 19, 2026
by
Tim Neutkens
Committed by
GitHub
Sep 16, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix adapter i18n App route handling
parent
f696914f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
108 additions
and
9 deletions
+108
-9
build-complete.ts
packages/next/src/build/adapter/build-complete.ts
+5
-2
i18n-app-pages-domain-routing.test.ts
...ages-domain-routing/i18n-app-pages-domain-routing.test.ts
+18
-6
next.config.js
.../e2e/app-dir/i18n-app-pages-domain-routing/next.config.js
+5
-1
proxy.ts
test/e2e/app-dir/i18n-app-pages-domain-routing/proxy.ts
+8
-0
adapter-config-i18n.test.ts
...roduction/adapter-config-i18n/adapter-config-i18n.test.ts
+45
-0
route.ts
...oduction/adapter-config-i18n/app/[lang]/endpoint/route.ts
+6
-0
page.tsx
test/production/adapter-config-i18n/app/[lang]/page.tsx
+7
-0
page.tsx
test/production/adapter-config-i18n/app/fr/static/page.tsx
+3
-0
layout.tsx
test/production/adapter-config-i18n/app/layout.tsx
+11
-0
No files found.
packages/next/src/build/adapter/build-complete.ts
View file @
9561de0e
...
@@ -1240,7 +1240,7 @@ export async function handleBuildComplete({
...
@@ -1240,7 +1240,7 @@ export async function handleBuildComplete({
config
.
i18n
?.
locales
||
[]
config
.
i18n
?.
locales
||
[]
).
pathname
).
pathname
const
parentOutput
=
const
parentOutput
=
pageOutputMap
[
normalizedSrcRoute
]
||
app
OutputMap
[
normalizedSrcRoute
]
appOutputMap
[
srcRoute
]
||
page
OutputMap
[
normalizedSrcRoute
]
if
(
!
parentOutput
&&
!
allowMissing
)
{
if
(
!
parentOutput
&&
!
allowMissing
)
{
console
.
error
({
console
.
error
({
...
@@ -2089,6 +2089,7 @@ export async function handleBuildComplete({
...
@@ -2089,6 +2089,7 @@ export async function handleBuildComplete({
const
dynamicRoutes
:
DynamicRouteItem
[]
=
[]
const
dynamicRoutes
:
DynamicRouteItem
[]
=
[]
const
dynamicDataRoutes
:
DynamicRouteItem
[]
=
[]
const
dynamicDataRoutes
:
DynamicRouteItem
[]
=
[]
const
dynamicSegmentRoutes
:
DynamicRouteItem
[]
=
[]
const
dynamicSegmentRoutes
:
DynamicRouteItem
[]
=
[]
const
appPathnames
=
new
Set
(
appPageKeys
?.
map
(
normalizeAppPath
)
??
[])
const
getDestinationQuery
=
(
routeKeys
:
Record
<
string
,
string
>
)
=>
{
const
getDestinationQuery
=
(
routeKeys
:
Record
<
string
,
string
>
)
=>
{
const
items
=
Object
.
entries
(
routeKeys
??
{})
const
items
=
Object
.
entries
(
routeKeys
??
{})
...
@@ -2131,7 +2132,9 @@ export async function handleBuildComplete({
...
@@ -2131,7 +2132,9 @@ export async function handleBuildComplete({
route
.
page
route
.
page
)
)
const
shouldLocalize
=
Boolean
(
config
.
i18n
&&
!
isAPIRoute
(
route
.
page
))
const
shouldLocalize
=
Boolean
(
config
.
i18n
&&
!
isAPIRoute
(
route
.
page
)
&&
!
appPathnames
.
has
(
route
.
page
)
)
const
routeRegex
=
getNamedRouteRegex
(
route
.
page
,
{
const
routeRegex
=
getNamedRouteRegex
(
route
.
page
,
{
prefixRouteKeys
:
true
,
prefixRouteKeys
:
true
,
...
...
test/e2e/app-dir/i18n-app-pages-domain-routing/i18n-app-pages-domain-routing.test.ts
View file @
9561de0e
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
load
}
from
'cheerio'
import
{
load
}
from
'cheerio'
const
deploymentHost
=
process
.
env
.
NEXT_TEST_DEPLOYMENT_HOST
||
(
process
.
env
.
VERCEL
===
'1'
?
process
.
env
.
VERCEL_URL
:
undefined
)
describe
(
'i18n-app-pages-domain-routing'
,
()
=>
{
describe
(
'i18n-app-pages-domain-routing'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
const
{
next
,
isNextDeploy
}
=
nextTestSetup
({
files
:
__dirname
,
files
:
__dirname
,
// Adapter-generated routing metadata is covered separately. This suite
// This layer includes the adapter routing fix, so exercise the shared
// verifies the built-in router and cannot run in deploy mode until the
// regression fixture in deployment mode as well.
// adapter-specific follow-up is applied.
skipDeployment
:
false
,
skipDeployment
:
true
,
})
})
function
fetchFromDomain
(
pathname
:
string
,
host
=
'nl.example.local'
)
{
function
fetchFromDomain
(
pathname
:
string
,
host
=
deploymentHost
||
'nl.example.local'
)
{
if
(
isNextDeploy
)
{
// The deployed URL already uses the hostname configured through
// NEXT_TEST_DEPLOYMENT_HOST or the provider's deployment environment.
return
next
.
fetch
(
pathname
)
}
return
next
.
fetch
(
pathname
,
{
return
next
.
fetch
(
pathname
,
{
headers
:
{
host
},
headers
:
{
host
},
})
})
...
...
test/e2e/app-dir/i18n-app-pages-domain-routing/next.config.js
View file @
9561de0e
/**
/**
* @type {import('next').NextConfig}
* @type {import('next').NextConfig}
*/
*/
const
deploymentHost
=
process
.
env
.
NEXT_TEST_DEPLOYMENT_HOST
||
(
process
.
env
.
VERCEL
===
'1'
?
process
.
env
.
VERCEL_URL
:
undefined
)
const
nextConfig
=
{
const
nextConfig
=
{
i18n
:
{
i18n
:
{
locales
:
[
'en-US'
,
'nl-NL'
],
locales
:
[
'en-US'
,
'nl-NL'
],
...
@@ -12,7 +16,7 @@ const nextConfig = {
...
@@ -12,7 +16,7 @@ const nextConfig = {
defaultLocale
:
'en-US'
,
defaultLocale
:
'en-US'
,
},
},
{
{
domain
:
'nl.example.local'
,
domain
:
deploymentHost
||
'nl.example.local'
,
defaultLocale
:
'nl-NL'
,
defaultLocale
:
'nl-NL'
,
},
},
],
],
...
...
test/e2e/app-dir/i18n-app-pages-domain-routing/proxy.ts
View file @
9561de0e
import
{
NextRequest
,
NextResponse
}
from
'next/server'
import
{
NextRequest
,
NextResponse
}
from
'next/server'
const
deploymentHost
=
process
.
env
.
NEXT_TEST_DEPLOYMENT_HOST
||
(
process
.
env
.
VERCEL
===
'1'
?
process
.
env
.
VERCEL_URL
:
undefined
)
const
localeByHost
=
new
Map
([
const
localeByHost
=
new
Map
([
[
'en.example.local'
,
'en-US'
],
[
'en.example.local'
,
'en-US'
],
[
'nl.example.local'
,
'nl-NL'
],
[
'nl.example.local'
,
'nl-NL'
],
])
])
if
(
deploymentHost
)
{
localeByHost
.
set
(
deploymentHost
,
'nl-NL'
)
}
export
function
proxy
(
request
:
NextRequest
)
{
export
function
proxy
(
request
:
NextRequest
)
{
const
hostname
=
request
.
headers
.
get
(
'host'
)?.
split
(
':'
,
1
)[
0
]
||
''
const
hostname
=
request
.
headers
.
get
(
'host'
)?.
split
(
':'
,
1
)[
0
]
||
''
const
locale
=
localeByHost
.
get
(
hostname
)
||
'en-US'
const
locale
=
localeByHost
.
get
(
hostname
)
||
'en-US'
...
...
test/production/adapter-config-i18n/adapter-config-i18n.test.ts
View file @
9561de0e
...
@@ -35,6 +35,51 @@ describe('adapter config with i18n routes', () => {
...
@@ -35,6 +35,51 @@ describe('adapter config with i18n routes', () => {
)
)
})
})
it
(
'keeps dynamic App routes in the literal namespace'
,
async
()
=>
{
const
{
outputs
,
routing
}:
Parameters
<
NextAdapter
[
'onBuildComplete'
]
>
[
0
]
=
await
next
.
readJSON
(
'build-complete.json'
)
const
appPageOutput
=
outputs
.
appPages
.
find
(
(
output
)
=>
output
.
pathname
===
'/[lang]'
)
const
appRouteOutput
=
outputs
.
appRoutes
.
find
(
(
output
)
=>
output
.
pathname
===
'/[lang]/endpoint'
)
const
appPageRoute
=
routing
.
dynamicRoutes
.
find
(
(
route
)
=>
route
.
source
===
'/[lang]'
)
const
appRoute
=
routing
.
dynamicRoutes
.
find
(
(
route
)
=>
route
.
source
===
'/[lang]/endpoint'
)
expect
(
appPageOutput
).
toBeDefined
()
expect
(
appRouteOutput
).
toBeDefined
()
expect
(
appPageRoute
).
toBeDefined
()
expect
(
appPageRoute
?.
sourceRegex
).
not
.
toContain
(
'nextLocale'
)
expect
(
appPageRoute
?.
destination
).
toBe
(
'/[lang]?nxtPlang=$nxtPlang'
)
expect
(
appRoute
).
toBeDefined
()
expect
(
appRoute
?.
sourceRegex
).
not
.
toContain
(
'nextLocale'
)
expect
(
appRoute
?.
destination
).
toBe
(
'/[lang]/endpoint?nxtPlang=$nxtPlang'
)
})
it
(
'links prerenders with locale-like App segments to their App output'
,
async
()
=>
{
const
{
outputs
}:
Parameters
<
NextAdapter
[
'onBuildComplete'
]
>
[
0
]
=
await
next
.
readJSON
(
'build-complete.json'
)
const
appPageOutput
=
outputs
.
appPages
.
find
(
(
output
)
=>
output
.
pathname
===
'/fr/static'
)
const
prerenderOutput
=
outputs
.
prerenders
.
find
(
(
output
)
=>
output
.
pathname
===
'/fr/static'
)
expect
(
appPageOutput
).
toBeDefined
()
expect
(
prerenderOutput
).
toBeDefined
()
expect
(
prerenderOutput
?.
parentOutputId
).
toBe
(
appPageOutput
?.
id
)
})
it
(
'does not emit outputs multiple times for a given pathname'
,
async
()
=>
{
it
(
'does not emit outputs multiple times for a given pathname'
,
async
()
=>
{
const
{
outputs
}:
Parameters
<
NextAdapter
[
'onBuildComplete'
]
>
[
0
]
=
const
{
outputs
}:
Parameters
<
NextAdapter
[
'onBuildComplete'
]
>
[
0
]
=
await
next
.
readJSON
(
'build-complete.json'
)
await
next
.
readJSON
(
'build-complete.json'
)
...
...
test/production/adapter-config-i18n/app/[lang]/endpoint/route.ts
0 → 100644
View file @
9561de0e
export
async
function
GET
(
_request
:
Request
,
{
params
}:
{
params
:
Promise
<
{
lang
:
string
}
>
}
)
{
return
Response
.
json
({
lang
:
(
await
params
).
lang
})
}
test/production/adapter-config-i18n/app/[lang]/page.tsx
0 → 100644
View file @
9561de0e
export
default
async
function
Page
({
params
,
}:
{
params
:
Promise
<
{
lang
:
string
}
>
})
{
return
<
p
>
App page:
{
(
await
params
).
lang
}
</
p
>
}
test/production/adapter-config-i18n/app/fr/static/page.tsx
0 → 100644
View file @
9561de0e
export
default
function
Page
()
{
return
<
p
>
static App page
</
p
>
}
test/production/adapter-config-i18n/app/layout.tsx
0 → 100644
View file @
9561de0e
export
default
function
RootLayout
({
children
,
}:
{
children
:
React
.
ReactNode
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
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