Skip to content

Commit 9433e96

Browse files
committed
feat(split-chunks): sync configurable dedupDepth from rspack
Use frozen intersection rounds and complete original-set support. Rebuild candidates from remaining original module-chunk edges between cache-group priorities.
1 parent 4098381 commit 9433e96

38 files changed

Lines changed: 1550 additions & 1235 deletions

‎.changeset/012-split-chunk-intersections.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
"webpack": minor
33
---
44

5-
Discover shared chunk intersections before enforcing splitChunks size limits.
5+
Add `optimization.splitChunks.dedupDepth` to discover shared chunk intersections before enforcing size limits. It defaults to `1` in production (including an omitted mode) and `0` in development or none. `0` uses existing combinations; `1` intersects original sets; each further round also uses sets found in previous rounds. Discovery stops when no new sets remain. Higher depths can increase computation exponentially.
6+
7+
The option accepts integers from `0` to `4294967295` and cannot be overridden in cache groups. Discovery applies to unnamed groups with a positive `minSize` or `minSizeReduction`; all normal extraction constraints still apply. Candidates are rebuilt from remaining original module-chunk edges between cache-group priorities.

‎cspell.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"datastructures",
104104
"debugids",
105105
"declarators",
106+
"dedup",
106107
"dedupe",
107108
"deduplicating",
108109
"deduplication",

‎lib/config/defaults.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,7 @@ const applyOptimizationDefaults = (
26252625
: [JAVASCRIPT_TYPE, UNKNOWN_TYPE]
26262626
);
26272627
D(splitChunks, "hidePathInfo", production);
2628+
D(splitChunks, "dedupDepth", production ? 1 : 0);
26282629
D(splitChunks, "chunks", "async");
26292630
D(splitChunks, "usedExports", optimization.usedExports === true);
26302631
D(splitChunks, "minChunks", 1);

0 commit comments

Comments
 (0)