perf(build): deduplicate plugin-sdk chunks to fix ~2x memory regression#45426
Conversation
Greptile SummaryThis PR fixes a ~2x memory regression introduced in 3.12 by consolidating all plugin-sdk entries into a single tsdown build pass, enabling Rollup's chunk-sharing mechanism. Previously, each of the 44 entries was built independently, causing massive duplication of shared modules (e.g. 20 copies of Key changes:
Minor observation:
Unchecked test-plan items:
Confidence Score: 4/5
Last reviewed commit: f62ec20 |
5587e7e to
310f8f0
Compare
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%)
310f8f0 to
98acb17
Compare
|
Landed via temp rebase onto main.
Thanks @TarasShyn! |
…nks @TarasShyn) (cherry picked from commit b7ff825)
Summary
query-expansion, 14 copies offetch, 11 copies oflogger)Measured impact
dist/sizeplugin-sdk/sizeTest plan
pnpm buildsucceeds with noINEFFECTIVE_DYNAMIC_IMPORTwarningspnpm test:fastpasses (956/958 pass; 2 pre-existing failures onmain)