getsentry / getsentry/sentry-javascript

Migrate to Rolldown

Đang mở
#19,221 1 bình luận 2 reaction 1 người được giao Được @logaretm nhận Xem trên GitHub
javascript State: Blocked Task
Ngôn ngữ chính
TypeScript
Star
8.7k
Fork
1.8k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
515

Mô tả

[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]()

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.