tsdown

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

tsdown

tsdown

Rolldown + Oxc powered TypeScript bundler. Drop-in tsup replacement.
基于Rolldown + Oxc的TypeScript打包工具。可直接替代tsup。

When to Use

适用场景

  • Building TypeScript libraries
  • Generating .d.ts declarations
  • Publishing npm packages
  • Dual ESM/CJS output
  • Vue/React component libraries
  • 构建TypeScript库
  • 生成.d.ts声明文件
  • 发布npm包
  • 双ESM/CJS输出
  • Vue/React组件库

Quick Start

快速开始

bash
npm i -D tsdown typescript
ts
// tsdown.config.ts
import { defineConfig } from 'tsdown'

export default defineConfig({
  entry: 'src/index.ts',
  format: 'esm',
  dts: true,
  exports: true,
})
bash
tsdown           # Build
tsdown --watch   # Watch mode
bash
npm i -D tsdown typescript
ts
// tsdown.config.ts
import { defineConfig } from 'tsdown'

export default defineConfig({
  entry: 'src/index.ts',
  format: 'esm',
  dts: true,
  exports: true,
})
bash
tsdown           # 构建
tsdown --watch   # 监听模式

Reference Files

参考文档

TaskFile
Config file, CLI, entry pointsconfig.md
Format, target, dts, exports, validationoutput.md
Shims, unbundle, watch, frameworks, WASMfeatures.md
Plugins, hooks, lint, programmatic, migrationadvanced.md
任务文件
配置文件、CLI、入口点config.md
格式、目标环境、dts、导出、验证output.md
垫片、不打包、监听、框架、WASMfeatures.md
插件、钩子、代码检查、程序化调用、迁移advanced.md

Loading Files

文件加载建议

Consider loading these reference files based on your task:
  • references/config.md - if setting up tsdown.config.ts, CLI, or entry points
  • references/output.md - if configuring output format, target, .d.ts, exports, or validation
  • references/features.md - if using shims, unbundle, watch mode, framework integrations, or WebAssembly
  • references/advanced.md - if writing plugins, using linting/validation, programmatic API, or migrating from tsup
DO NOT load all files at once. Load only what's relevant to your current task.
请根据你的任务加载对应的参考文件:
  • references/config.md - 若你正在设置tsdown.config.ts、CLI或入口点
  • references/output.md - 若你正在配置输出格式、目标环境、.d.ts、导出或验证
  • references/features.md - 若你正在使用垫片、不打包模式、监听模式、框架集成或WebAssembly
  • references/advanced.md - 若你正在编写插件、使用代码检查/验证、程序化API或从tsup迁移
请勿一次性加载所有文件。仅加载与当前任务相关的文件。

Cross-Skill References

跨技能参考

  • Library patterns → Use
    ts-library
    skill
  • Vue component libs → Use
    vue
    skill
  • Package management → Use
    pnpm
    skill
  • 库模式 → 使用
    ts-library
    技能
  • Vue组件库 → 使用
    vue
    技能
  • 包管理 → 使用
    pnpm
    技能