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

Migrating a Real TypeScript OSS Library from tsup to tsdown

Description and use

Migrating is‑kit from tsup to tsdown required only configuration changes and a smoke test to preserve the package contract. Using outExtensions restored the original filenames, and the artifact size grew by ~23.6 %.

Problem

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

Outcome

The migration required only configuration changes and a smoke test. The package contract was preserved by customizing outExtensions, and the final artifact met all original export and declaration expectations. Build time was similar, and the output size increased by ~23.6%.

Workflow

  • Replace tsup with tsdown dependency
  • Rename tsup.config.ts to tsdown.config.mts
  • Copy most config options (entry, format, dts, clean, outDir, target, banner)
  • Run pnpm build – observe that output filenames differ
  • Add outExtensions function to map format to desired extensions
  • Run pnpm build again – filenames match original contract
  • Run packed‑package smoke test to verify exports, runtime, and declarations
  • Measure artifact size and build time for comparison

Evidence

The first tsdown build succeeded while silently changing files that were already part of the package's public contract.

Source

The config migration was small. Preserving the package contract was the interesting part.

Source

I used outExtensions: ({ format }) => ({ dts: format === 'cjs' ? '.d.ts' : '.d.mts', js: format === 'cjs' ? '.js' : '.mjs', }),

Source

After the migration, I expanded the test to verify more of the package contract

Source

The tsdown output retained more comments and region markers than the previous tsup output.

Source

  • Record date: 2026-10-22T21:26:11.924Z