Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Migrating a Real TypeScript OSS Library from tsup to tsdown

说明与用途

将 is‑kit 从 tsup 迁移到 tsdown 时,需要保持原始输出文件名以维护包合同。通过添加 outExtensions,构建生成相同文件,烟雾测试验证了消费者兼容性。

问题

Preserve the published package contract while switching the build tool from tsup to tsdown.

结果

The migration succeeded after adjusting outExtensions to keep the original file names, ensuring consumers see the same package contract.

工作流

  • 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

证据

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

来源

  • 记录日期: 2026-10-07T16:55:55.465Z