Skip to content

Commit a2708f8

Browse files
authored
fix: patch rollup manualChunks deps merging (#1132)
1 parent ec21f64 commit a2708f8

File tree

4 files changed

+67
-22
lines changed

4 files changed

+67
-22
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
"prettier-plugin-tailwindcss": "^0.6.12",
117117
"pretty-quick": "^4.0.0",
118118
"qwik-nx": "^3.2.0",
119+
"rollup": "4.50.0",
119120
"sass": "^1.77.2",
120121
"shiki": "^3.4.2",
121122
"simple-git-hooks": "2.11.1",

patches/rollup.patch

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
diff --git a/dist/es/shared/node-entry.js b/dist/es/shared/node-entry.js
2+
index 5700a270678df36456ae65dcad01a2be4a28189b..58ec105e925c9f7c9c41ebef3946fb175fabd61c 100644
3+
--- a/dist/es/shared/node-entry.js
4+
+++ b/dist/es/shared/node-entry.js
5+
@@ -19384,7 +19384,7 @@ function getChunkDefinitionsFromManualChunks(manualChunkAliasByEntry) {
6+
const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
7+
const manualChunkModulesByAlias = Object.create(null);
8+
for (const [entry, alias] of manualChunkAliasByEntry) {
9+
- addStaticDependenciesToManualChunk(entry, (manualChunkModulesByAlias[alias] ||= []), modulesInManualChunks);
10+
+ (manualChunkModulesByAlias[alias] ||= []).push(entry);
11+
}
12+
const manualChunks = Object.entries(manualChunkModulesByAlias);
13+
const chunkDefinitions = new Array(manualChunks.length);
14+
@@ -19394,18 +19394,7 @@ function getChunkDefinitionsFromManualChunks(manualChunkAliasByEntry) {
15+
}
16+
return { chunkDefinitions, modulesInManualChunks };
17+
}
18+
-function addStaticDependenciesToManualChunk(entry, manualChunkModules, modulesInManualChunks) {
19+
- const modulesToHandle = new Set([entry]);
20+
- for (const module of modulesToHandle) {
21+
- modulesInManualChunks.add(module);
22+
- manualChunkModules.push(module);
23+
- for (const dependency of module.dependencies) {
24+
- if (!(dependency instanceof ExternalModule || modulesInManualChunks.has(dependency))) {
25+
- modulesToHandle.add(dependency);
26+
- }
27+
- }
28+
- }
29+
-}
30+
+
31+
function analyzeModuleGraph(entries) {
32+
const dynamicEntryModules = new Set();
33+
const awaitedDynamicEntryModules = new Set();

pnpm-lock.yaml

Lines changed: 30 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ onlyBuiltDependencies:
1414
- tree-sitter-typescript
1515
- unrs-resolver
1616
- workerd
17+
18+
patchedDependencies:
19+
rollup: patches/rollup.patch

0 commit comments

Comments
 (0)