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
5c7a4468
Unverified
Commit
5c7a4468
authored
Jun 29, 2026
by
Sam Poder
Committed by
GitHub
Jun 29, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[turbopack] Use experimental chunking heuristics (#95026)
<!-- NEXT_JS_LLM_PR -->
parent
be6039d7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
31 deletions
+107
-31
project.rs
crates/next-api/src/project.rs
+4
-0
context.rs
crates/next-core/src/next_client/context.rs
+9
-0
production.rs
...ck/crates/turbopack-core/src/chunk/chunking/production.rs
+82
-31
chunking_context.rs
...opack/crates/turbopack-core/src/chunk/chunking_context.rs
+12
-0
No files found.
crates/next-api/src/project.rs
View file @
5c7a4468
...
@@ -1602,6 +1602,7 @@ impl Project {
...
@@ -1602,6 +1602,7 @@ impl Project {
self
:
Vc
<
Self
>
,
self
:
Vc
<
Self
>
,
)
->
Result
<
Vc
<
Box
<
dyn
ChunkingContext
>>>
{
)
->
Result
<
Vc
<
Box
<
dyn
ChunkingContext
>>>
{
let
css_url_suffix
=
self
.next_config
()
.asset_suffix_path
();
let
css_url_suffix
=
self
.next_config
()
.asset_suffix_path
();
let
chunking_heuristics
=
self
.next_config
()
.chunking_heuristics
()
.await
?
;
Ok
(
get_client_chunking_context
(
ClientChunkingContextOptions
{
Ok
(
get_client_chunking_context
(
ClientChunkingContextOptions
{
mode
:
self
.next_mode
(),
mode
:
self
.next_mode
(),
root_path
:
self
.project_root_path
()
.owned
()
.await
?
,
root_path
:
self
.project_root_path
()
.owned
()
.await
?
,
...
@@ -1632,6 +1633,9 @@ impl Project {
...
@@ -1632,6 +1633,9 @@ impl Project {
cross_origin
:
self
.next_config
()
.cross_origin
(),
cross_origin
:
self
.next_config
()
.cross_origin
(),
chunk_loading_global
:
self
.next_config
()
.turbopack_chunk_loading_global
(),
chunk_loading_global
:
self
.next_config
()
.turbopack_chunk_loading_global
(),
style_groups_algorithm
:
self
.next_config
()
.css_chunking
()
.owned
()
.await
?
,
style_groups_algorithm
:
self
.next_config
()
.css_chunking
()
.owned
()
.await
?
,
chunking_first_page_load_priority
:
chunking_heuristics
.first_page_load_priority
,
chunking_priority_boost_percent
:
chunking_heuristics
.priority_boost_percent
,
chunking_request_cost
:
chunking_heuristics
.request_cost
,
}))
}))
}
}
...
...
crates/next-core/src/next_client/context.rs
View file @
5c7a4468
...
@@ -482,6 +482,9 @@ pub struct ClientChunkingContextOptions {
...
@@ -482,6 +482,9 @@ pub struct ClientChunkingContextOptions {
pub
cross_origin
:
Vc
<
CrossOrigin
>
,
pub
cross_origin
:
Vc
<
CrossOrigin
>
,
pub
chunk_loading_global
:
Vc
<
Option
<
RcStr
>>
,
pub
chunk_loading_global
:
Vc
<
Option
<
RcStr
>>
,
pub
style_groups_algorithm
:
StyleGroupsAlgorithm
,
pub
style_groups_algorithm
:
StyleGroupsAlgorithm
,
pub
chunking_first_page_load_priority
:
Option
<
u32
>
,
pub
chunking_priority_boost_percent
:
Option
<
u32
>
,
pub
chunking_request_cost
:
Option
<
u64
>
,
}
}
/// Next.js' chunk-load retry policy for the Turbopack browser runtime.
/// Next.js' chunk-load retry policy for the Turbopack browser runtime.
...
@@ -520,6 +523,9 @@ pub async fn get_client_chunking_context(
...
@@ -520,6 +523,9 @@ pub async fn get_client_chunking_context(
cross_origin
,
cross_origin
,
chunk_loading_global
,
chunk_loading_global
,
style_groups_algorithm
,
style_groups_algorithm
,
chunking_first_page_load_priority
,
chunking_priority_boost_percent
,
chunking_request_cost
,
}
=
options
;
}
=
options
;
let
next_mode
=
mode
.await
?
;
let
next_mode
=
mode
.await
?
;
...
@@ -584,6 +590,9 @@ pub async fn get_client_chunking_context(
...
@@ -584,6 +590,9 @@ pub async fn get_client_chunking_context(
min_chunk_size
:
50
_000
,
min_chunk_size
:
50
_000
,
max_chunk_count_per_group
:
40
,
max_chunk_count_per_group
:
40
,
max_merge_chunk_size
:
200
_000
,
max_merge_chunk_size
:
200
_000
,
first_page_load_priority
:
chunking_first_page_load_priority
,
priority_boost_percent
:
chunking_priority_boost_percent
,
request_cost
:
chunking_request_cost
,
..
Default
::
default
()
..
Default
::
default
()
},
},
)
)
...
...
turbopack/crates/turbopack-core/src/chunk/chunking/production.rs
View file @
5c7a4468
This diff is collapsed.
Click to expand it.
turbopack/crates/turbopack-core/src/chunk/chunking_context.rs
View file @
5c7a4468
...
@@ -260,6 +260,18 @@ pub struct ChunkingConfig {
...
@@ -260,6 +260,18 @@ pub struct ChunkingConfig {
/// type.
/// type.
pub
style_groups_algorithm
:
StyleGroupsAlgorithm
,
pub
style_groups_algorithm
:
StyleGroupsAlgorithm
,
/// First-page-load priority as an integer percentage (`0..=100`), or `None` to use the
/// default. Used by the production chunker's merge heuristics.
pub
first_page_load_priority
:
Option
<
u32
>
,
/// Priority boost as an integer percentage (e.g. `150` for a 1.5x boost), or `None` to use the
/// default. Used by the production chunker's merge heuristics.
pub
priority_boost_percent
:
Option
<
u32
>
,
/// Estimated request cost in bytes, or `None` to use the default. Used by the production
/// chunker's merge heuristics.
pub
request_cost
:
Option
<
u64
>
,
#[allow(dead_code)]
#[allow(dead_code)]
pub
placeholder_for_future_extensions
:
(),
pub
placeholder_for_future_extensions
:
(),
}
}
...
...
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