getsentry / getsentry/sentry-javascript

Migrate to Rolldown

Open
#19,221 1 comment 2 reactions 1 assignee Claimed by @logaretm View on GitHub
javascript State: Blocked Task
Dominant language
TypeScript
Stars
8.7k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
515

Description

[Rolldown]() is a Rust-based, Rollup-compatible bundler that offers 10–30x faster bundling while maintaining the same plugin API.

### Benchmarks

Early results show \~10% bundle size reductions on some packages, with further gains expected once we eliminate JS plugins (Sucrase, Replace, License, TypeScript, Terser) in favor of Rolldown's built-in equivalents.

From the `@sentry/browser` build comparison:

**Rolldown (1.0.0-beta.53) vs Rollup (4.35.0)**

* **Average build time:** 5.65s vs 41.79s — **\~7.4x faster**
* **Min:** 5.24s vs 41.40s
* **Max:** 6.31s vs 42.06s
* **Std dev:** 473ms vs 282ms (Rolldown is slightly less consistent, but at a fraction of the total time)

The bundle step is where the difference lives: **4.25s (75.2%)** with Rolldown vs **36.98s (88.5%)** with Rollup. Transpile time is effectively identical (\~1.4s). Rollup also has extra type generation steps (types:core, types:downlevel) that add \~3.4s, which Rolldown folds into a single transpile step.

TL;DR: **Build went from \~42s to \~6s. The bundling step alone is \~8.7x faster.**

### **Work items**

- [X] Get the build working repo-wide with Rolldown
- [X] Ensure all tests pass with correct export output
- [X] Remove JS plugins where possible (Sucrase, Replace, License, TypeScript, Terser)
- [X] Resolve upstream Rolldown blockers
- [ ] Handle type generation separately or via [`rolldown-plugin-dts`]()(Blocked by [https://github.com/getsentry/sentry-javascript/issues/18477]())
- [ ] Address CDN bundle size regressions
- [ ] Ensure user output is unaffected

### Caveats

* To unlock the highest potential gains, we need to drop TS 3.8 support to avoid the serial dependency between type generation and bundling.
* Rolldown type generation requires a dts-plugin which itself requires tsgo for highest perf gains, but we can keep using our current TS version for now. OXC can generate types but that requires isolated declarations which is not feasible for us to migrate to.
* Some workarounds had to be introduced to avoid some ESM/CJS compatibility differences between rollup and rolldown.

---

**Tracking PR:** [https://github.com/getsentry/sentry-javascript/pull/18156]()

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.