tsdown is a blazing-fast bundler for JavaScript and TypeScript libraries, leveraging the Rust-based Rolldown engine. It's designed for simplicity and efficiency, preconfiguring most settings to allow developers to focus on code. The current stable version is `0.21.9`, with frequent minor releases as seen in its active changelog. Key differentiators include its speed (powered by Oxc and Rolldown), a powerful ecosystem supporting Rolldown, Rollup, Unplugin, and some Vite plugins, and a focus on seamless migration for `tsup` users by offering compatible options and features. It also provides automatic TypeScript declaration generation, multiple output formats (esm, cjs, iife, umd), and built-in support for features like CSS handling and executable bundling.
npm install tsdownVerified import paths — ran on the pinned version, not inferred.
This quickstart sets up a basic TypeScript library with `tsdown`, demonstrating configuration for ESM and CommonJS outputs, type declaration generation, and basic build commands.
Update your `tsdown.config.ts` file to use the new `deps` namespace for dependency-related options. For example, `external: ['vue']` becomes `deps: { neverBundle: ['vue'] }`.Run `npm install @tsdown/css -D` (or `pnpm add @tsdown/css -D`, `yarn add @tsdown/css -D`) in your project.
If you use the experimental executable bundling, review your output paths. You may need to adjust your build scripts or `exe.outDir` configuration if you previously relied on executables being in the main output directory.
Ensure your project's `typescript` version matches the peer dependency range. Upgrade or downgrade TypeScript as needed (e.g., `npm install typescript@^5 -D`).
When upgrading `tsdown`, pay close attention to the release notes regarding `Rolldown` upgrades. Test your build thoroughly, especially if you rely on custom `Rolldown` plugins or advanced configurations.
Instead of relying on a stub mode, use `tsdown --watch` during development for automatic rebuilds, or configure `exports.devExports` in your `tsdown.config.ts` to point to source files for development and built files for production.
Install the `@tsdown/css` package as a development dependency: `npm install @tsdown/css -D` or `pnpm add @tsdown/css -D`.
Refactor your `tsdown.config.ts` to use the new `deps` namespace. For example, change `external: [...]` to `deps: { neverBundle: [...] }`.Ensure your project is configured for ESM by setting `"type": "module"` in your `package.json`, or use dynamic `import()` for `tsdown` modules. For config files, `tsdown.config.ts` should be an ESM file.
Upgrade your Node.js environment to version 20.19.0 or later. Consider using a Node Version Manager (NVM) to manage multiple Node.js versions.