Skip to content

Commit ccced29

Browse files
TarasShynsteipete
authored andcommitted
perf(build): deduplicate plugin-sdk chunks to fix ~2x memory regression
Bundle all plugin-sdk entries in a single tsdown build pass instead of 38 separate builds. The separate builds prevented the bundler from sharing common chunks, causing massive duplication (e.g. 20 copies of query-expansion, 14 copies of fetch, 11 copies of logger). Measured impact: - dist/ size: 190MB → 64MB (-66%) - plugin-sdk/ size: 142MB → 16MB (-89%) - JS files: 1,395 → 789 (-43%) - 5MB+ files: 27 → 7 (-74%) - Plugin-SDK heap cost: +1,309MB → +63MB (-95%) - Total heap (all chunks loaded): 1,926MB → 711MB (-63%)
1 parent 592d932 commit ccced29

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tsdown.config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ export default defineConfig([
116116
"line/template-messages": "src/line/template-messages.ts",
117117
},
118118
}),
119-
...pluginSdkEntrypoints.map((entry) =>
120-
nodeBuildConfig({
121-
entry: `src/plugin-sdk/${entry}.ts`,
122-
outDir: "dist/plugin-sdk",
123-
}),
124-
),
119+
nodeBuildConfig({
120+
// Bundle all plugin-sdk entries in a single build so the bundler can share
121+
// common chunks instead of duplicating them per entry (~712MB heap saved).
122+
entry: Object.fromEntries(pluginSdkEntrypoints.map((e) => [e, `src/plugin-sdk/${e}.ts`])),
123+
outDir: "dist/plugin-sdk",
124+
}),
125125
nodeBuildConfig({
126126
entry: "src/extensionAPI.ts",
127127
}),

0 commit comments

Comments
 (0)