Skip to content

chore: migrate from tsup to tsdown#60

Merged
MidnightDesign merged 4 commits intomasterfrom
chore/migrate-tsdown
Apr 9, 2026
Merged

chore: migrate from tsup to tsdown#60
MidnightDesign merged 4 commits intomasterfrom
chore/migrate-tsdown

Conversation

@MidnightDesign
Copy link
Copy Markdown
Collaborator

@MidnightDesign MidnightDesign commented Apr 9, 2026

Background

tsup is the bundler we use to produce CJS, ESM, and declaration files from our TypeScript source. It's powered by esbuild under the hood. tsup is no longer actively maintained and has a bug with TypeScript 6.0 — it unconditionally injects a baseUrl compiler option during declaration generation, which TS6 now rejects as deprecated. This blocks #59 (Dependabot dev-tooling update that includes the TS6 upgrade).

tsdown is tsup's spiritual successor, built on Rolldown (a Rust-based bundler) instead of esbuild. It supports TS6 out of the box and has a compatible configuration format.

Since tsup and tsdown use different bundler engines, our two custom esbuild plugins had to be ported to Rolldown's plugin API. The React Compiler plugin (which runs a Babel transform on every source file) was rewritten as a Rolldown transform hook. The CJS default interop fix for Emotion was dropped entirely — Rolldown's CJS output handles __esModule interop correctly without the workaround esbuild needed.

Summary

  • Replace tsup + esbuild with tsdown (rolldown-based bundler) to unblock TypeScript 6.0 upgrade
  • Port react-compiler babel plugin from esbuild onLoad to rolldown transform hook
  • Drop fixCjsDefaultInteropPlugin — rolldown handles CJS interop correctly without the esbuild isNodeMode bug

Details

  • Update package.json exports with condition-specific types (.d.mts for ESM, .d.cts for CJS)
  • Update api-extractor config for new .d.mts entry point
  • Update AGENTS.md and dependabot.yml references from tsup to tsdown
  • Remove babel-plugin-react-compiler from knip ignoreDependencies (knip detects it through tsdown config)
  • Remove onlyBuiltDependencies for esbuild (rolldown uses optional deps, no install scripts)
  • Enable babel sourcemaps in react-compiler plugin for accurate source map chaining

Test plan

  • Build passes (pnpm build)
  • All 66 tests pass (pnpm test)
  • Lint, typecheck, knip pass
  • API report changes are cosmetic only (pnpm api:check)
  • CJS output verified — @emotion/styled default export resolves correctly
  • CI green

🤖 Generated with Claude Code

MidnightDesign and others added 2 commits April 9, 2026 10:58
tsup is effectively unmaintained and has a bug with TypeScript 6.0
(egoist/tsup#1388 — unconditionally injects baseUrl which triggers
TS5101). tsdown is the spiritual successor, powered by Rolldown, and
supports TS6 out of the box.

- Replace tsup + esbuild with tsdown (rolldown-based bundler)
- Port react-compiler babel plugin from esbuild onLoad to rolldown
  transform hook
- Remove fixCjsDefaultInteropPlugin (rolldown handles CJS interop
  correctly without the isNodeMode bug)
- Update package.json exports to match tsdown output extensions
  (.mjs/.d.mts for ESM, .cjs/.d.cts for CJS)
- Update api-extractor config for new .d.mts entry point
- Remove esbuild from onlyBuiltDependencies in pnpm-workspace.yaml

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove rolldown type import (transitive dep, not direct) — let TS infer the plugin type
- Remove babel-plugin-react-compiler from knip ignoreDependencies (knip can now detect it via tsdown config)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the @eventjet/react-seatmaps package build pipeline from tsup/esbuild to tsdown (rolldown-based) to unblock a future TypeScript 6 upgrade and align emitted artifacts/exports with tsdown’s output.

Changes:

  • Replace tsup config/plugins with a tsdown config, porting the React compiler Babel transform to rolldown’s transform hook.
  • Update package.json exports/types fields and API Extractor entrypoint to use .mjs / .d.mts.
  • Remove the pnpm onlyBuiltDependencies allowlist entry and adjust knip ignored dependencies.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Removes onlyBuiltDependencies configuration from the workspace.
packages/seatmaps/tsup.config.ts Deletes the prior tsup/esbuild build configuration (including the CJS interop patch).
packages/seatmaps/tsdown.config.ts Adds tsdown config and ports the React compiler Babel transform.
packages/seatmaps/package.json Switches build scripts to tsdown; updates exports/types to .mjs/.d.mts; removes esbuild and tsup deps.
packages/seatmaps/api/react-seatmaps.api.md Updates API report output corresponding to the new declaration emit/import aliasing.
packages/seatmaps/api-extractor.json Points API Extractor at dist/index.d.mts.
knip.json Updates ignored dependency list for knip.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

MidnightDesign and others added 2 commits April 9, 2026 11:15
- Update AGENTS.md references from tsup to tsdown
- Update dependabot.yml build-tools group pattern from tsup to tsdown
- Add condition-specific types in package.json exports (d.mts for ESM, d.cts for CJS)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pass sourceMaps: true to transformAsync so the transform produces
source maps that Rolldown can chain into the final bundle output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MidnightDesign MidnightDesign requested a review from rieschl April 9, 2026 09:29
@MidnightDesign MidnightDesign merged commit 6aca0c8 into master Apr 9, 2026
6 checks passed
@MidnightDesign MidnightDesign deleted the chore/migrate-tsdown branch April 9, 2026 21:22
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.

3 participants