skillfed

tsdown

tsdown packages your TypeScript and JavaScript code for npm distribution while preserving complete type information. This skill automates the bundling process, ensuring your libraries ship with accurate type declarations for better developer experience and IDE support.

tsdown is a TypeScript library bundler that packages your TypeScript and JavaScript code for npm distribution while preserving complete type information. The skill automates the bundling process, ensuring your libraries ship with accurate type declarations for better developer experience and IDE support.

AI-generated summary based on this skill's SKILL.md

5,665 313 MIT updated by antfu

Install

antfu/skills/tsdown · repository language: TypeScript

CLI (skillfed)coming soon
git clone https://github.com/antfu/skills
cp -r skills/skills/tsdown ~/.claude/skills/tsdown

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What is tsdown and what does it do for TypeScript libraries?

tsdown is a TypeScript library bundler that packages your TypeScript and JavaScript code for npm distribution while preserving complete type information. The skill automates the bundling process, ensuring your libraries ship with accurate type declarations for better developer experience and IDE support.

Can tsdown bundle TypeScript libraries for npm with type declarations?

Yes, tsdown specializes in bundling TypeScript and JavaScript libraries for npm with type declarations. It handles the complete packaging workflow, automatically generating and including .d.ts type declaration files so your published library provides full type information to consumers.

What output formats does tsdown support for bundled libraries?

tsdown can generate multiple output formats (ESM, CJS, IIFE, UMD) from a single source, allowing you to distribute your library in the formats your users need without maintaining separate build configurations.

Is tsdown a suitable alternative to tsup for faster bundling?

tsdown is designed as a faster bundler option with minimal configuration changes needed when migrating from tsup. It provides comparable functionality while improving build performance, making it an efficient choice for teams looking to speed up their TypeScript library builds.

Can tsdown be used to build React and Vue component libraries?

Yes, tsdown efficiently builds React, Vue, Solid, and Svelte component libraries. It handles the specific requirements of framework component bundling while maintaining type safety and generating the necessary type declarations for component consumers.

How does tsdown optimize bundle size and performance?

tsdown optimizes bundle size through tree shaking, minification, and dependency control features. These capabilities help reduce your final bundle size while ensuring only necessary code is included in your npm distribution.

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' or target: '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

Related skills

Tags

build-tool module-bundling type-safety performance-focused multi-format-output tree-shaking component-libraries monorepo-support cli-tool source-maps