tsdown
tsdown is a bundling tool designed to package TypeScript and JavaScript libraries for npm distribution with support for multiple output formats. It simplifies the build process by offering flexible configuration options tailored to modern web development workflows.
tsdown is a bundling tool that packages TypeScript and JavaScript libraries for npm distribution with support for multiple output formats. To bundle your TypeScript library with tsdown, you configure it to generate the desired output formats (such as ESM and CommonJS), and tsdown handles the compilation and bundling process automatically. The tool simplifies the build workflow by offering flexible configuration options tailored to modern web development needs.
AI-generated summary based on this skill's SKILL.md
Install
hairyf/skills/tsdown · repository language: MDX
git clone https://github.com/hairyf/skills
cp -r skills/skills/tsdown ~/.claude/skills/tsdownFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I bundle a TypeScript library with tsdown?
tsdown is a bundling tool that packages TypeScript and JavaScript libraries for npm distribution with support for multiple output formats. To bundle your TypeScript library with tsdown, you configure it to generate the desired output formats (such as ESM and CommonJS), and tsdown handles the compilation and bundling process automatically. The tool simplifies the build workflow by offering flexible configuration options tailored to modern web development needs.
What is the tsdown vs tsup comparison?
tsdown is designed as a modern alternative to tsup for bundling TypeScript libraries. While both tools serve similar purposes in packaging libraries for npm, tsdown offers a streamlined approach with its own set of configuration options and build optimizations. If you're considering a migration from tsup, tsdown provides a path forward with minimal configuration changes required to adapt your existing build setup.
Can tsdown generate type declarations and optimize bundles with tree shaking?
Yes, tsdown supports generating type declarations (DTS files) as part of its bundling process, ensuring your published library includes proper TypeScript support. The tool also incorporates tree shaking and minification capabilities to optimize your bundles, reducing the final package size and improving performance for consumers of your library.
Does tsdown support bundling React, Vue, Solid, or Svelte component libraries?
tsdown is well-suited for building component libraries across multiple frameworks including React, Vue, Solid, and Svelte. Its flexible configuration and support for multiple output formats make it an effective choice for packaging framework-specific component libraries for npm distribution.
How do I migrate from tsup to tsdown?
tsdown is designed to facilitate migration from tsup with minimal configuration changes required. The tool maintains compatibility with common build patterns and configuration approaches, allowing you to transition your existing tsup-based projects to tsdown without extensive rework of your build setup.
Can tsdown create standalone executables or CLI tools?
tsdown supports bundling for standalone executables and CLI tools, though this represents a secondary use case compared to its primary focus on bundling TypeScript and JavaScript libraries for npm. The tool's bundling capabilities can be leveraged to package command-line applications and executable programs alongside traditional library distributions.
SKILL.md
rendered from the published skill — quoted content, verbatim
tsdown - The Elegant Library Bundler
Blazing-fast bundler for TypeScript/JavaScript libraries powered by Rolldown and Oxc.
Runtime Requirement
tsdown requires Node.js 22.18.0 or higher to run (build-time only). However, the bundled output can target much lower Node.js versions via the target option, so libraries built with tsdown are not locked to Node.js 22+ at runtime.
If your package needs to support Node.js 18 / 20:
- Build with Node.js 22+ in CI (e.g. set
target: 'node18'ortarget: 'node20'). - Test the built output (or the packed tarball) on the lower Node.js versions you intend to support — e.g. using a matrix job that runs the published package's tests on Node.js 18 / 20 / 22.
When to Use
- Building TypeScript/JavaScript libraries for npm
- Generating TypeScript declaration files (.d.ts)
- Bundling for multiple formats (ESM, CJS, IIFE, UMD)
- Optimizing bundles with tree
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 15 files
skills/tsdown/LICENSE.md
skills/tsdown/README.md
skills/tsdown/SKILL.md
skills/tsdown/SYNC.md
skills/tsdown/references/README.md
skills/tsdown/references/advanced-benchmark.md
skills/tsdown/references/advanced-ci.md
skills/tsdown/references/advanced-hooks.md
skills/tsdown/references/advanced-plugins.md
skills/tsdown/references/advanced-programmatic.md
skills/tsdown/references/advanced-rolldown-options.md
skills/tsdown/references/guide-getting-started.md
skills/tsdown/references/guide-introduction.md
skills/tsdown/references/guide-migrate-from-tsup.md
skills/tsdown/references/option-cjs-default.md