Migrate from tsup
tsup is a powerful and widely-used bundler that shares many similarities with tsdown. While tsup is built on top of esbuild, tsdown leverages the power of Rolldown to deliver a faster and more powerful bundling experience.
Migration Guide
If you're currently using tsup and want to migrate to tsdown, the process is straightforward thanks to the dedicated migrate command:
npx tsdown migrateWARNING
Please save your changes before migration. The migration process may modify your configuration files, so it's important to ensure all your changes are committed or backed up beforehand.
Migration Options
The migrate command supports the following options to customize the migration process:
--cwd <dir>(or-c): Specify the working directory for the migration.--dry-run(or-d): Perform a dry run to preview the migration without making any changes.
With these options, you can easily tailor the migration process to fit your specific project setup.
Differences from tsup
While tsdown aims to be highly compatible with tsup, there are some differences to be aware of:
Default Values
format: Defaults toesm.clean: Enabled by default and will clean theoutDirbefore each build.dts: Automatically enabled if yourpackage.jsoncontains atypingsortypesfield.target: By default, reads from theengines.nodefield in yourpackage.jsonif available.
Feature Gaps
Some features available in tsup are not yet implemented in tsdown. If you find an option missing that you need, please open an issue to let us know your requirements.
New Features in tsdown
tsdown also introduces new features not available in tsup:
nodeProtocol: Control how Node.js built-in module imports are handled:true: Addnode:prefix to built-in modules (e.g.,fs→node:fs)'strip': Removenode:prefix from imports (e.g.,node:fs→fs)false: Keep imports as-is (default)
Please review your configuration after migration to ensure it matches your expectations.
Acknowledgements
tsdown would not have been possible without the inspiration and contributions of the open-source community. We would like to express our heartfelt gratitude to the following:
- tsup:
tsdownwas heavily inspired bytsup, and even incorporates parts of its codebase. The simplicity and efficiency oftsupserved as a guiding light during the development oftsdown. - @egoist: The creator of
tsup, whose work has significantly influenced the JavaScript and TypeScript tooling ecosystem. Thank you for your dedication and contributions to the community.