Migrating a Real TypeScript OSS Library from tsup to tsdown
Description and use
Migrating is‑kit from tsup to tsdown required preserving original output filenames to maintain the package contract. Adding outExtensions ensured the build produced the same files, and smoke tests verified consumer compatibility.
Problem
Preserve the published package contract while switching the build tool from tsup to tsdown.
Outcome
The migration succeeded after adjusting outExtensions to keep the original file names, ensuring consumers see the same package contract.
Workflow
- Replace tsup with tsdown and create tsdown.config.mts
- Map tsup options to tsdown (entry, format, dts, clean, outDir, target, banner)
- Run pnpm build – build succeeds but filenames differ
- Identify mismatch between generated files and package.json exports
- Add outExtensions mapping to preserve original filenames
- Rebuild – filenames now match exports
- Run packed‑package smoke test to verify consumer behavior
Evidence
The first tsdown build succeeded while silently changing files that were already part of the package's public contract.
Build success ≠ package contract preserved.
I used outExtensions to preserve the existing filenames
- Record date: 2026-10-07T16:55:55.465Z