Skip to content

chore(build): Replace sucrase with esbuild#20865

Open
mydea wants to merge 13 commits into
developfrom
feat/replace-sucrase
Open

chore(build): Replace sucrase with esbuild#20865
mydea wants to merge 13 commits into
developfrom
feat/replace-sucrase

Conversation

@mydea
Copy link
Copy Markdown
Member

@mydea mydea commented May 13, 2026

This PR updates our rollup config to use esbuild instead of sucrase/typescript plugins.

  1. We relied on a custom, kind of weird fork of sucrase here to get the proper es support we cared about with minimal bundle size. this is not really ideal...
  2. We also still had some code paths (for the replay worker) relying on typescript plugin, which we have since dropped in other places already. this PR unifies this to use esbuild everywhere.
  3. This also allows us to get rid of the cleanup plugin as this is handled by esbuild already anyhow.
  4. Using esbuild is a more future proof solution here, we can easily update es support and it will handle it for us.
  5. Removes any rollup dependencies we actually no longer use (some where orphaned already)

Doing this, required a few changes to our rollup plugin setup, which all should be generally good changes IMHO:

  • With esbuild, the order of some of our plugins becomes more important, as esbuild strips certain comments etc. more aggressively. This PR takes care of this by being more explicit in the order of plugins and enforcing this everywhere.

Overall bundle size seems stable, slight reductions in a few places - execpt for cloudflare, which actually has a 3.5kb reduction for whatever reason.

@mydea mydea self-assigned this May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 26.92 kB - -
@sentry/browser - with treeshaking flags 25.35 kB -0.02% -3 B 🔽
@sentry/browser (incl. Tracing) 44.78 kB -0.13% -56 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 46.78 kB -0.11% -51 B 🔽
@sentry/browser (incl. Tracing, Profiling) 49.77 kB -0.11% -54 B 🔽
@sentry/browser (incl. Tracing, Replay) 84.4 kB -0.06% -49 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 73.87 kB -0.07% -46 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 89.1 kB -0.06% -48 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 101.74 kB -0.06% -56 B 🔽
@sentry/browser (incl. Feedback) 44.1 kB -0.02% -5 B 🔽
@sentry/browser (incl. sendFeedback) 31.73 kB -0.01% -2 B 🔽
@sentry/browser (incl. FeedbackAsync) 36.84 kB -0.01% -2 B 🔽
@sentry/browser (incl. Metrics) 28.01 kB -0.01% -1 B 🔽
@sentry/browser (incl. Logs) 28.15 kB -0.02% -3 B 🔽
@sentry/browser (incl. Metrics & Logs) 28.84 kB -0.01% -1 B 🔽
@sentry/react 28.66 kB -0.03% -8 B 🔽
@sentry/react (incl. Tracing) 47.02 kB -0.17% -77 B 🔽
@sentry/vue 31.85 kB +0.03% +8 B 🔺
@sentry/vue (incl. Tracing) 46.65 kB -0.13% -57 B 🔽
@sentry/svelte 26.94 kB +0.01% +2 B 🔺
CDN Bundle 29.3 kB -0.03% -7 B 🔽
CDN Bundle (incl. Tracing) 47.19 kB -0.1% -43 B 🔽
CDN Bundle (incl. Logs, Metrics) 30.67 kB -0.03% -8 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 48.33 kB -0.08% -36 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 69.98 kB -0.11% -71 B 🔽
CDN Bundle (incl. Tracing, Replay) 84.59 kB -0.07% -54 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 85.66 kB -0.07% -59 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 90.41 kB -0.06% -52 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 91.48 kB -0.09% -74 B 🔽
CDN Bundle - uncompressed 86.26 kB -0.02% -11 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 141.65 kB -0.13% -180 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 90.46 kB -0.02% -11 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 145.11 kB -0.13% -180 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 215.1 kB -0.1% -215 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 260.35 kB -0.09% -220 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 263.79 kB -0.09% -220 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 274.05 kB -0.09% -220 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 277.48 kB -0.08% -220 B 🔽
@sentry/nextjs (client) 49.54 kB -0.14% -67 B 🔽
@sentry/sveltekit (client) 45.25 kB -0.13% -58 B 🔽
@sentry/node-core 61.94 kB -0.03% -18 B 🔽
@sentry/node 166.84 kB -0.06% -87 B 🔽
@sentry/node - without tracing 74.35 kB -0.03% -16 B 🔽
@sentry/aws-serverless 109.16 kB -0.02% -17 B 🔽
@sentry/cloudflare (withSentry) - minified 170.6 kB -0.17% -287 B 🔽
@sentry/cloudflare (withSentry) 427.56 kB -0.83% -3.54 kB 🔽

View base workflow run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8dc63cf. Configure here.

Comment thread packages/core/src/utils/env.ts
@mydea mydea force-pushed the feat/replace-sucrase branch from db29e47 to d6f4a1c Compare May 15, 2026 06:38
@mydea mydea force-pushed the feat/replace-sucrase branch from d6f4a1c to 6c34c49 Compare May 15, 2026 09:08
@mydea mydea marked this pull request as ready for review May 15, 2026 09:39
@mydea mydea requested review from a team as code owners May 15, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant