Skip to content

Enhancement: Migrate from tsup to tsdown #46

@gander

Description

@gander

Enhancement Description

The project currently uses tsup as the build tool. However, tsup is no longer actively maintained. The official tsup repository now includes a warning recommending migration to tsdown:

This project is not actively maintained anymore. Please consider using tsdown instead.

Proposed Solution

Migrate from tsup to tsdown, which is the recommended successor and offers:

  • Blazing fast performance: Powered by Rolldown and Oxc for incredibly fast builds and declaration file generation
  • Seamless migration: Compatible with tsup's main options and features with an automated migration tool
  • Active maintenance: Maintained by Kevin Deng, who previously co-maintained tsup
  • Powerful ecosystem: Supports Rollup, Rolldown, unplugin plugins, and some Vite plugins
  • Future-proof: Will be used as the foundation for the next iteration of Vite's library mode

Migration Steps

tsdown provides an automated migration command:

npx tsdown migrate

For monorepos with multiple packages:

npx tsdown migrate packages/*

The migration tool automatically:

  • Updates devDependencies in package.json
  • Migrates build and dev scripts
  • Converts tsup configuration files to tsdown format

You can preview changes without applying them using the --dry-run flag:

npx tsdown migrate --dry-run

Key Differences to Review

After migration, review the following default value changes:

  • format: Defaults to esm instead of multiple formats
  • clean: Enabled by default, cleans outDir before each build
  • dts: Auto-enabled if package.json contains typings or types field
  • target: Reads from engines.node field in package.json if available

Additional Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions