Skip to content

chore: Switch to rolldown - #20775

Draft
logaretm wants to merge 11 commits into
developfrom
tim/awad/use-rolldown
Draft

chore: Switch to rolldown#20775
logaretm wants to merge 11 commits into
developfrom
tim/awad/use-rolldown

Conversation

@logaretm

@logaretm logaretm commented May 8, 2026

Copy link
Copy Markdown
Member

Refreshed what we had in #18156 with the latest rolldown and let's see if we can get this one out.

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.46 kB -0.37% -104 B 🔽
@sentry/browser - with treeshaking flags 26.81 kB -0.42% -113 B 🔽
@sentry/browser - with treeshaking flags tracing without tracing 26.71 kB -0.39% -102 B 🔽
@sentry/browser (incl. Tracing) 48.6 kB -0.03% -11 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 48.61 kB -0.04% -15 B 🔽
@sentry/browser (incl. Tracing, Profiling) 51.59 kB +0.1% +47 B 🔺
@sentry/browser (incl. Tracing, Replay) 88.02 kB -0.09% -75 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.37 kB -0.15% -113 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 92.34 kB -0.5% -456 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 105.46 kB -0.03% -23 B 🔽
@sentry/browser (incl. Feedback) 45.77 kB -0.04% -17 B 🔽
@sentry/browser (incl. sendFeedback) 33.26 kB -0.3% -97 B 🔽
@sentry/browser (incl. FeedbackAsync) 38.38 kB -0.21% -77 B 🔽
@sentry/browser (incl. Metrics) 29.31 kB -0.68% -199 B 🔽
@sentry/browser (incl. Logs) 29.61 kB -0.64% -188 B 🔽
@sentry/browser (incl. Metrics & Logs) 30.25 kB -0.61% -184 B 🔽
@sentry/react 30.3 kB -0.04% -10 B 🔽
@sentry/react (incl. Tracing) 50.92 kB +0.2% +101 B 🔺
@sentry/vue 35.34 kB -0.97% -343 B 🔽
@sentry/vue (incl. Tracing) 50.55 kB -0.62% -311 B 🔽
@sentry/svelte 28.48 kB -0.37% -105 B 🔽
CDN Bundle 30.24 kB -0.38% -115 B 🔽
CDN Bundle (incl. Tracing) 48.97 kB -0.26% -126 B 🔽
CDN Bundle (incl. Logs, Metrics) 32.6 kB +0.1% +32 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 50.95 kB -0.08% -36 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 72.78 kB -0.3% -216 B 🔽
CDN Bundle (incl. Tracing, Replay) 86.21 kB -0.45% -389 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.12 kB -0.43% -376 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 95.58 kB +3.48% +3.21 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.62 kB +3.52% +3.32 kB 🔺
CDN Bundle - uncompressed 89.35 kB -0.69% -618 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 145.85 kB -0.63% -922 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 95.76 kB -0.53% -501 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 151.62 kB -0.56% -842 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 223.54 kB -0.84% -1.88 kB 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 263.64 kB -0.99% -2.63 kB 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.41 kB -0.94% -2.53 kB 🔽
⛔️ CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed (max: 285 kB) 286.32 kB +2.28% +6.37 kB 🔺
⛔️ CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed (max: 291 kB) 292.08 kB +2.27% +6.46 kB 🔺
@sentry/nextjs (client) 53.83 kB +0.82% +436 B 🔺
@sentry/sveltekit (client) 49.38 kB +0.66% +323 B 🔺
@sentry/core/server 65.21 kB -0.15% -95 B 🔽
@sentry/core/browser 52.36 kB +0.03% +14 B 🔺
@sentry/node 114.77 kB -6.47% -7.93 kB 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.68 kB +0.55% +465 B 🔺
@sentry/node - without tracing 79.58 kB -9.52% -8.37 kB 🔽
@sentry/aws-serverless 87.6 kB -8.92% -8.57 kB 🔽
@sentry/cloudflare (withSentry) - minified 199.3 kB -0.14% -271 B 🔽
@sentry/cloudflare (withSentry) 465.61 kB -6.08% -30.11 kB 🔽

View base workflow run

@logaretm
logaretm force-pushed the tim/awad/use-rolldown branch 6 times, most recently from 64ea470 to bf6f465 Compare May 12, 2026 16:20
@logaretm
logaretm force-pushed the tim/awad/use-rolldown branch 9 times, most recently from 1f4024d to 7d12000 Compare May 28, 2026 16:20
@logaretm
logaretm force-pushed the tim/awad/use-rolldown branch 3 times, most recently from e3dab2d to 5104f9a Compare June 4, 2026 20:07
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you apply the label PR: no-auto-close I will leave it alone ... forever!

@logaretm
logaretm force-pushed the tim/awad/use-rolldown branch 7 times, most recently from 7e9a9c6 to c823474 Compare August 25, 2026 19:35
@logaretm
logaretm force-pushed the tim/awad/use-rolldown branch 2 times, most recently from f6f8fd2 to 3139435 Compare August 26, 2026 14:20
logaretm and others added 10 commits August 26, 2026 22:35
Co-Authored-By: Codex <codex@openai.com>
The dedicated `Build Lambda layer` CI job runs `build:layer` itself, so having
`build:transpile` chain it too built the layer twice per run.
Rolldown compiles each bundled CJS dependency into `var require_x = __commonJSMin(...)`
and has consumers pull it in with `import { require_x } from './body.js'`. That named
import is used, so nothing downstream can drop it, which dragged the parse/query/generate
chain (meriyah, astring, source-map, esquery) into every consumer's runtime bundle.

`@rollup/plugin-commonjs` split each CJS module into a tiny virtual module holding the
exports plus a body imported only for its side effects, which `sideEffects: false` lets a
downstream bundler drop. Reproduce that split for the transformer chain.
…n bundled

The orchestrion transformer chain is deliberately split so a downstream bundler can
drop it (server-utils' `makeCjsExportsSplitPlugin`). Two ways that split can go wrong
and both fail silently at build time: splitting a module whose export is called at
module-evaluation time, and reading the container in a way that throws when the body
was dropped. Bundle to ESM with tree-shaking and run `init()` to catch either.
rolldown 1.2.6 ships oxc's property mangler (rolldown/rolldown#10374), so the terser
config the rollup build used can be ported back: `mangle.reserved` and the
`/^_[^_]/` property regex with its reserved list.

The option is `minify.mangleProps`, not `minify.mangle.properties` - the latter is the
oxc-level interface the reference docs describe and rolldown ignores it silently.
PROVISIONAL - pushed to see the full size picture in CI, not to ship as-is.

Feedback's npm build bundles to a single file, so the CDN build has to rely on
intra-module DCE to strip the lazily-loaded modal/screenshot code and Preact from a
module it only needs `core` from. Rolldown does that less aggressively than rollup:
Preact's renderer stayed in, costing ~9 kB in the feedback CDN bundles.

Preserving modules lets ordinary module-level tree-shaking handle it, dropping Preact
entirely (feedback CDN bundle goes from +8,963 to -1,993 vs develop). The tradeoff is
that the published package becomes 31 modules instead of one bundled file, which needs
a decision before this ships.
The rolldown commit rewrote this template's default re-export and dropped the
suppression on the placeholder side-effect import along with it, which fails
lint:types.
This reverts commit 044308a.

preserveModules emits preact as a relative import into a node_modules directory
that does not exist in the published package, so every app that ships the browser
SDK dies at startup on
build/npm/esm/node_modules/preact/dist/preact.module.js. That broke the four
solidstart E2E apps and debug-id-sourcemaps.
Rolldown infers platform 'browser' for the ESM half of every npm build, and that
platform defines process.env.NODE_ENV. Every
`process.env.NODE_ENV !== 'development'` guard folded to a constant and DCE
deleted the branch behind it, so the ESM output of the vite integrations shipped
without the orchestrion code-transformer, the source-map plugin and the custom
vite plugins, while the CJS half kept all three.

That is why react-router-7's build-injection tests saw mysql and ioredis left
external, react-router-sourcemaps found no debug IDs in a client chunk, and the
db-span assertions failed across astro, tanstackstart and react-router-cloudflare.

Mapping the key to itself keeps the runtime lookup, so the guard is evaluated by
the consumer as it always was. Verified across all eight packages that reference
it: ESM now matches CJS matches source.
@logaretm
logaretm force-pushed the tim/awad/use-rolldown branch from f719fe1 to 4eeb1e2 Compare August 27, 2026 02:46
…check

resolveShimFile() branched on `typeof require === 'function'` to tell the CJS
build from the ESM one. Rolldown renames a bare `require` to its own
`__require` polyfill, a Proxy over a function that throws, so in the ESM build
the typeof check passed, `__require.resolve` was undefined, and calling it threw
straight into the catch. resolveShimFile() returned undefined, the _HANDLER
redirect was skipped, and the Lambda ran completely uninstrumented - silently,
since the catch only logs in debug builds. That is why every aws-serverless test
timed out waiting for envelopes rather than failing an assertion.

createRequire(import.meta.url) already works in both halves: the CJS output
rewrites import.meta.url to a pathToFileURL(__filename) equivalent. Verified the
redirect now fires in both formats, and the ESM build no longer pulls in the
rolldown runtime at all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant