tsdown

Bundle TypeScript and JavaScript libraries into ESM, CJS, IIFE, and UMD formats with Rolldown.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/bramanda48/skills --skill tsdown-bramanda48
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tsdown
Source: https://github.com/bramanda48/skills/tree/main/skills/tsdown
Command: npx skills add https://github.com/bramanda48/skills --skill tsdown-bramanda48

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Configuring a bundler for library publishing involves juggling output formats, type declarations, dependency externalization, and package.json exports, which is error-prone when done by hand. ## Core Features & Use Cases - Multi-Format Library Builds: Configure entry points, output formats (ESM, CJS, IIFE, UMD), targets, platforms, minification, tree shaking, and sourcemaps through tsdown config files or CLI flags. - Type Declarations & Dependency Control: Generate .d.ts files and control bundling with deps.neverBundle, alwaysBundle, onlyBundle, and onlyImport rules. - Framework Recipes & Migration: Set up React, Vue, Solid, Svelte, and WASM library builds, plus migrate existing projects from tsup using tsdown-migrate. - Use Case: You maintain an npm component library and need ESM and CJS outputs with type declarations, externalized React dependencies, and auto-generated package.json exports validated by publint and attw in CI. ## Quick Start Set up tsdown to build my TypeScript library in src/index.ts with ESM and CJS formats, type declarations, and React externalized.

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 with tsdown?

Install tsdown as a dev dependency, create a tsdown.config.ts with defineConfig specifying entry, format such as ['esm', 'cjs'], and dts: true, then run npx tsdown. The output is written to the dist directory by default.

How do I migrate from tsup to tsdown?

Run npx tsdown-migrate in your project after committing changes. The tool renames options like entryPoints to entry and cjsInterop to cjsDefault, and installs tsdown v0.22.14 first so deprecation warnings reveal any remaining old options.

Does tsdown support React and Vue component libraries?

Yes, tsdown provides recipes for React, Vue, Solid, and Svelte. For React, externalize react and react-dom via deps.neverBundle and set the JSX runtime; for Vue, SFC support and vue-tsc type generation are covered.

What Node.js version does tsdown require?

tsdown requires Node.js 22.18.0 or higher to run the bundler itself. The bundled output can target lower versions like Node.js 18 or 20 via the target option, so build in CI with Node 22+ and test output on older versions.

How do I externalize dependencies in tsdown?

Dependencies, peerDependencies, and optionalDependencies from package.json are externalized automatically. Override this with deps.neverBundle to force externals, deps.alwaysBundle to force bundling, or deps.neverBundle: true to externalize everything.

Why is my tsdown build failing after migrating from tsup?

Common causes are Node.js below 22.18, missing TypeScript for DTS generation, or leftover tsup options that v0.23+ silently ignores. Install [email protected] first, resolve all deprecation warnings, then upgrade to the latest version.