chore: Switch to rolldown - #20775
Draft
logaretm wants to merge 11 commits into
Draft
Conversation
Contributor
size-limit report 📦
|
logaretm
force-pushed
the
tim/awad/use-rolldown
branch
6 times, most recently
from
May 12, 2026 16:20
64ea470 to
bf6f465
Compare
logaretm
force-pushed
the
tim/awad/use-rolldown
branch
9 times, most recently
from
May 28, 2026 16:20
1f4024d to
7d12000
Compare
logaretm
force-pushed
the
tim/awad/use-rolldown
branch
3 times, most recently
from
June 4, 2026 20:07
e3dab2d to
5104f9a
Compare
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 |
logaretm
force-pushed
the
tim/awad/use-rolldown
branch
7 times, most recently
from
August 25, 2026 19:35
7e9a9c6 to
c823474
Compare
logaretm
force-pushed
the
tim/awad/use-rolldown
branch
2 times, most recently
from
August 26, 2026 14:20
f6f8fd2 to
3139435
Compare
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
force-pushed
the
tim/awad/use-rolldown
branch
from
August 27, 2026 02:46
f719fe1 to
4eeb1e2
Compare
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refreshed what we had in #18156 with the latest rolldown and let's see if we can get this one out.