Conversation
Add a lightweight parallel rollup runner that processes config arrays concurrently using the rollup JS API. Use it for @sentry/browser's build:bundle which runs 93 rollup builds (31 entrypoints × 3 variants). This reduces the browser bundle build from ~175s to ~65s (~2.6x faster), which was the critical path for the full `yarn build`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
size-limit report 📦
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b8fd53b. Configure here.
| let done = 0; | ||
|
|
||
| async function worker() { | ||
| while (queue.length > 0) { |
There was a problem hiding this comment.
l: We could abort once a worker failed.
There was a problem hiding this comment.
hmm not sure what would be more helpful here actually 🤔 but I suppose if rollup() fails this would throw an error and abort the while thing anyhow..?
|
Note: Once we move to rolldown we can probably revert this partially, at least how we run this, because there configs are built in parallel out of the box. cc #18156 |

Previously, running
yarn build:bundlesfor the browser package is one of the biggest blocker for build time. This is because this builds ~90 bundles in series via rollup. This PR adds a small script to run multiple rollup builds in parallel, hopefully speeding this up significantly. Locally I saw an improvement from ~150s to ~70s.It turns out this is a bit harder than expected because we were kind of incorrectly relying on shared rollup plugin instances for our builds, which seems not to be recommended. So I (or cursor, actually) rewrote this to instead generate a standalone plugin instance for each build so they cannot conflict.
Summary
dev-packages/rollup-utils/rollupParallel.mjs— a ~30 line script that runs rollup config arrays concurrently using the rollup JS API (concurrency = CPU count)@sentry/browser'sbuild:bundle, which builds 93 rollup configs (31 entrypoints × 3 variants:.js,.min.js,.debug.min.js)Rollup processes config arrays sequentially. This was the critical path for
yarn build— the browser bundle step alone took ~175s. With parallel execution it completes in ~65s (~2.6x speedup).The other packages with
build:bundle(replay, feedback, replay-canvas, wasm) only have 3-6 configs each, so the overhead isn't worth it there.Test plan
yarn buildinpackages/browserproduces all 93 bundles + sourcemaps🤖 Generated with Claude Code