tsdown

Bundle TypeScript libraries into ESM, CJS, IIFE, and UMD formats with type declarations.

5.7k|318|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/antfu/skills --skill tsdown-antfu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tsdown
Source: https://github.com/antfu/skills/tree/main/skills/tsdown
Command: npx skills add https://github.com/antfu/skills --skill tsdown-antfu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

tsdown accelerates bundling of TypeScript libraries into multiple formats while generating accurate type declarations and exports metadata, removing manual configuration drudgery.

Core Features & Use Cases

  • Multi-format bundling: produce esm, cjs, iife, and umd outputs with per-format overrides.
  • Type declarations & maps: generate .d.ts files with optional declaration maps for monorepos.
  • Exports automation: auto-generate package.json fields like main, module, types, and exports for libraries.
  • Workspace support & migration: easily build workspaces and migrate from tsup with a dedicated migration tool.

Quick Start

  • Install: npm i -D tsdown
  • Basic build: npx tsdown
  • Build for multiple formats: npx tsdown --format esm,cjs
  • Migrate from tsup: npx tsdown-migrate

Frequently Asked Questions about tsdown

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I bundle a TypeScript library into multiple formats like ESM and CJS?

To bundle a TypeScript library into multiple formats, you can generate ESM, CJS, IIFE, and UMD outputs simultaneously with per-format overrides. This removes manual configuration drudgery and automates outputs for versatile package distribution.

What is the best way to generate type declarations for a TypeScript workspace?

Generating type declarations for a TypeScript workspace involves producing .d.ts files with optional declaration maps. This process automates accurate type exports metadata, removing manual configuration drudgery for monorepos.

How do I automate package.json exports fields for my TypeScript library?

Automating package.json exports fields for a TypeScript library auto-generates the main, module, types, and exports fields. This eliminates manual metadata configuration and ensures correct multi-format bundle consumption.

Does tsdown support migrating an existing tsup configuration?

Yes, migrating an existing tsup configuration is supported using a dedicated migration tool. You can transition your library bundling setup by running the provided migration command to adopt the new build process.

Can I apply per-format overrides when generating dts files?

Yes, you can apply per-format overrides when generating .d.ts files and multi-format bundles. This allows specific configurations for ESM, CJS, IIFE, and UMD outputs while maintaining accurate type declarations.