Skip to content

build: replace tsup with tsdown and apply React Compiler to published dist#799

Open
acasazza wants to merge 1 commit into
refactor/payment-standalone-componentsfrom
chore/migrate-tsup-to-tsdown
Open

build: replace tsup with tsdown and apply React Compiler to published dist#799
acasazza wants to merge 1 commit into
refactor/payment-standalone-componentsfrom
chore/migrate-tsup-to-tsdown

Conversation

@acasazza

Copy link
Copy Markdown
Member

Why

  • tsup is in maintenance mode; tsdown (rolldown-based) is its designated successor.
  • Faster builds.
  • The old tsup config had a babelOptions key that tsup silently ignoredbabel-plugin-react-compiler was never actually applied to any published artifact. This PR makes it real: 9 compiled functions in hooks, 134 in react-components (target: '19').

What changed

  • All three packages (core, hooks, react-components) build with tsdown ^0.22.4; the compiler is wired via @rolldown/plugin-babel + reactCompilerPreset() (official tsdown recipe).
  • Regression guard: build runs a check-compiler assertion that react/compiler-runtime is present in both dist files, so a silently-skipped compiler can never ship again. All three packages now have uniform ci scripts; react-components gains the attw --pack exports check it was missing.
  • Output parity with tsup: identical filenames (fixedExtension: false), identical exports maps, "use client" banner, and an externals diff of exactly one line — react/compiler-runtime. platform: 'browser' on react-components keeps rolldown's require-interop shim browser-safe (the node default emits a top-level node:module import that breaks consumer bundles).
  • hooks peer range tightened to react >=19.0.0 (compiled output imports the built-in compiler runtime) — ⚠️ breaking, flag as major at the next make:version.
  • prop-types removed from react-components: its untyped import broke the rolldown dts build, and all its validators were dead code (the published dist had zero trace of them). One internal type rewritten as a plain interface; public types unchanged.

Verification

  • Unit tests: 766 + 145 + 129 pass; attw green on all resolution modes for all three packages; pnpm typecheck reports the same pre-existing error set as before (no additions).
  • E2E: mfe-checkout (linked dist, React 19.2.7) ran guest-addresses.spec.ts 12×/12 clean — better than the 11/12 tsup baseline.

Note: mfe-checkout needed a React 18.3.1 → 19.2.7 upgrade to consume the compiled dist (React 18 has no react/compiler-runtime); that change lives in the mfe-checkout repo and is not yet committed there.

🤖 Generated with Claude Code

… dist

tsup silently ignored the babelOptions config, so babel-plugin-react-compiler
was never actually applied to any published artifact. tsdown (rolldown) wires
it through @rolldown/plugin-babel + reactCompilerPreset with target 19, and a
post-build check-compiler guard now fails the build if the compiler output
ever goes missing again.

- hooks: react peer range tightened to >=19.0.0 (compiled output imports the
  built-in react/compiler-runtime)
- react-components: platform browser keeps the require-interop shim
  browser-safe; gains check-exports (attw) and a ci script like its siblings
- drop prop-types: its validators were dead code only used to derive one
  internal type, and its untyped import broke the rolldown dts build
@acasazza acasazza self-assigned this Jul 17, 2026
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