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
206fa758
Unverified
Commit
206fa758
authored
Oct 16, 2025
by
Niklas Mischkulnig
Committed by
GitHub
Oct 16, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: fix pageExtensions precedence (#84926)
Webpack doesn't use the specified order, it's by length.
parent
1bb64bf9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
next_config.rs
crates/next-core/src/next_config.rs
+6
-1
next.config.js
test/integration/custom-page-extension/next.config.js
+5
-3
No files found.
crates/next-core/src/next_config.rs
View file @
206fa758
...
@@ -1388,7 +1388,12 @@ impl NextConfig {
...
@@ -1388,7 +1388,12 @@ impl NextConfig {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
pub
fn
page_extensions
(
&
self
)
->
Vc
<
Vec
<
RcStr
>>
{
pub
fn
page_extensions
(
&
self
)
->
Vc
<
Vec
<
RcStr
>>
{
Vc
::
cell
(
self
.page_extensions
.clone
())
// Sort page extensions by length descending. This mirrors the Webpack behavior in Next.js,
// which just builds a regex alternative, which greedily matches the longest
// extension: https://github.com/vercel/next.js/blob/32476071fe331948d89a35c391eb578aed8de979/packages/next/src/build/entries.ts#L409
let
mut
extensions
=
self
.page_extensions
.clone
();
extensions
.sort_by_key
(|
ext
|
std
::
cmp
::
Reverse
(
ext
.len
()));
Vc
::
cell
(
extensions
)
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
...
...
test/integration/custom-page-extension/next.config.js
View file @
206fa758
module
.
exports
=
{
module
.
exports
=
(
phase
,
{
defaultConfig
})
=>
({
pageExtensions
:
[
'page.js'
],
// Append the custom extension to the default page extensions, to ensure that matching precedence
}
// is by length.
pageExtensions
:
[...
defaultConfig
.
pageExtensions
,
'page.js'
],
})
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