Loading...
Loading...
Compare original and translation side by side
tsup.config.*tsdown.config.*'tsup''tsdown'tsdowntsup.config.*tsdown.config.*'tsup''tsdown'tsdown| tsup | tsdown |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| tsup | tsdown |
|---|---|
| |
| |
| |
| |
| |
| |
| |
// Before
import { defineConfig } from 'tsup'
// After
import { defineConfig } from 'tsdown'tsuptsdownTSUPTSDOWN// 迁移前
import { defineConfig } from 'tsup'
// 迁移后
import { defineConfig } from 'tsdown'tsuptsdownTSUPTSDOWN| tsup | tsdown | Notes |
|---|---|---|
| | CJS default export handling |
| | Now uses Rolldown/Unplugin plugins |
| tsup | tsdown | 说明 |
|---|---|---|
| | CJS默认导出处理 |
| | 现在使用Rolldown/Unplugin插件 |
| tsup (deprecated) | tsdown (preferred) | Notes |
|---|---|---|
| | Also deprecated in tsup itself |
| | Copy static files to output |
| (remove) | Bundle is default behavior |
| | Preserve file structure |
| | Strip |
| | CSS injection |
| (remove) | Default behavior |
| | Moved to deps namespace |
| | Moved to deps namespace |
| | Moved to deps namespace |
| tsup(已弃用) | tsdown(推荐) | 说明 |
|---|---|---|
| | tsup自身也已弃用该选项 |
| | 将静态文件复制到输出目录 |
| (移除) | 打包为默认行为 |
| | 保留文件结构 |
| | 移除 |
| | CSS注入 |
| (移除) | 默认行为 |
| | 移至deps命名空间下 |
| | 移至deps命名空间下 |
| | 移至deps命名空间下 |
depsexternalnoExternaldeps// Before (tsup)
export default defineConfig({
external: ['react'],
noExternal: ['lodash-es'],
})
// After (tsdown)
export default defineConfig({
deps: {
neverBundle: ['react'],
alwaysBundle: ['lodash-es'],
},
})deps.onlyBundledepsexternalnoExternaldeps// 迁移前(tsup)
export default defineConfig({
external: ['react'],
noExternal: ['lodash-es'],
})
// 迁移后(tsdown)
export default defineConfig({
deps: {
neverBundle: ['react'],
alwaysBundle: ['lodash-es'],
},
})deps.onlyBundle// Before (tsup - esbuild plugins)
import plugin from 'unplugin-example/esbuild'
// After (tsdown - Rolldown plugins)
import plugin from 'unplugin-example/rolldown'unplugin-*/esbuildunplugin-*/rolldown// 迁移前(tsup - esbuild插件)
import plugin from 'unplugin-example/esbuild'
// 迁移后(tsdown - Rolldown插件)
import plugin from 'unplugin-example/rolldown'unplugin-*/esbuildunplugin-*/rolldown| Option | tsup Default | tsdown Default | Migration Action |
|---|---|---|---|
| | | Set |
| | | Set |
| | Auto-enabled if | Set |
| (none) | Auto-reads from | Set |
| 选项 | tsup默认值 | tsdown默认值 | 迁移操作 |
|---|---|---|---|
| | | 设置 |
| | | 设置 |
| | 若package.json中存在 | 设置 |
| (无) | 从package.json的 | 设置 |
| tsup Option | Status | Alternative |
|---|---|---|
| Always enabled | Remove — code splitting cannot be disabled in tsdown |
| Not available | Suggest |
| Not supported | Remove — tsdown uses oxc for transformation (built-in) |
| Not supported | Use the |
| Not supported | Remove — no alternative |
| Incompatible | Migrate to Rolldown plugins manually; tsup's plugin API differs from Rolldown's |
| tsup选项 | 状态 | 替代方案 |
|---|---|---|
| 始终启用 | 移除——tsdown中无法禁用代码分割 |
| 暂不支持 | 建议使用 |
| 不支持 | 移除——tsdown内置使用oxc进行代码转换 |
| 不支持 | 使用 |
| 不支持 | 移除——无替代方案 |
| 不兼容 | 手动迁移至Rolldown插件;tsup的插件API与Rolldown不同 |
tsuptsup-nodetsdown// Before
{
"scripts": {
"build": "tsup src/index.ts",
"dev": "tsup --watch"
}
}
// After
{
"scripts": {
"build": "tsdown src/index.ts",
"dev": "tsdown --watch"
}
}tsuptsup-nodetsdown// 迁移前
{
"scripts": {
"build": "tsup src/index.ts",
"dev": "tsup --watch"
}
}
// 迁移后
{
"scripts": {
"build": "tsdown src/index.ts",
"dev": "tsdown --watch"
}
}| Location | Action |
|---|---|
| Rename to |
| Rename to |
| Rename to |
| Rename to |
| Rename to |
| 位置 | 操作 |
|---|---|
| 重命名为 |
| 重命名为 |
| 重命名为 |
| 重命名为 |
| 重命名为 |
tsuptsdown// Before
{ "tsup": { "entry": ["src/index.ts"] } }
// After
{ "tsdown": { "entry": ["src/index.ts"] } }tsuptsdown// 迁移前
{ "tsup": { "entry": ["src/index.ts"] } }
// 迁移后
{ "tsdown": { "entry": ["src/index.ts"] } }| Feature | Config | Description |
|---|---|---|
| Node protocol | | Add or strip |
| Workspace | | Build multiple packages in a monorepo |
| Package exports | | Auto-generate |
| Package validation | | Lint package and check type correctness |
| Executable | | Bundle as Node.js standalone executable (SEA) |
| DevTools | | Vite DevTools integration for bundle analysis |
| Hooks | | Lifecycle hooks: |
| CSS modules | | Scoped class names for |
| Glob import | | Support |
| 功能 | 配置 | 说明 |
|---|---|---|
| Node协议 | | 为内置导入添加或移除 |
| 工作区 | | 在单体仓库中构建多个包 |
| 包导出 | | 自动在package.json中生成 |
| 包验证 | | 检查包的规范与类型正确性 |
| 可执行文件 | | 打包为Node.js独立可执行文件(SEA) |
| 开发工具 | | 集成Vite DevTools用于打包分析 |
| 钩子 | | 生命周期钩子: |
| CSS模块 | | 为 |
| Glob导入 | | 支持 |
| Topic | Description | Reference |
|---|---|---|
| Option Mappings | Complete before/after for every option transform | guide-option-mappings |
| Detailed Differences | Architecture, features, compatibility comparison | guide-differences-detailed |
| Package.json | Dependency, script, and config field migration | guide-package-json |
| 主题 | 说明 | 参考链接 |
|---|---|---|
| 选项映射 | 所有选项转换的完整前后示例 | guide-option-mappings |
| 详细差异 | 架构、功能、兼容性对比 | guide-differences-detailed |
| package.json迁移 | 依赖项、脚本与配置字段迁移 | guide-package-json |
- [ ] Rename tsup.config.* → tsdown.config.*
- [ ] Update import from 'tsup' to 'tsdown'
- [ ] Replace tsup/TSUP identifiers with tsdown/TSDOWN
- [ ] Apply property renames (cjsInterop→cjsDefault, esbuildPlugins→plugins)
- [ ] Migrate deprecated options (publicDir→copy, bundle→unbundle, removeNodeProtocol→nodeProtocol, injectStyle→css.inject)
- [ ] Move external/noExternal/skipNodeModulesBundle into deps namespace
- [ ] Update unplugin imports from /esbuild to /rolldown
- [ ] Set explicit defaults to preserve tsup behavior (format, clean, dts, target)
- [ ] Remove unsupported options (splitting, metafile, swc, etc.)
- [ ] Update package.json scripts (tsup→tsdown)
- [ ] Update package.json dependencies
- [ ] Rename root-level tsup config field if present
- [ ] Run tsdown and verify build output
- [ ] Suggest new tsdown features to the user- [ ] 将tsup.config.*重命名为tsdown.config.*
- [ ] 将导入语句从'tsup'更新为'tsdown'
- [ ] 将tsup/TSUP标识符替换为tsdown/TSDOWN
- [ ] 应用属性重命名(cjsInterop→cjsDefault、esbuildPlugins→plugins)
- [ ] 迁移已弃用选项(publicDir→copy、bundle→unbundle、removeNodeProtocol→nodeProtocol、injectStyle→css.inject)
- [ ] 将external/noExternal/skipNodeModulesBundle移至deps命名空间下
- [ ] 将unplugin导入从/esbuild改为/rolldown
- [ ] 显式设置默认值以保留tsup行为(format、clean、dts、target)
- [ ] 移除不支持的选项(splitting、metafile、swc等)
- [ ] 更新package.json中的脚本(tsup→tsdown)
- [ ] 更新package.json中的依赖项
- [ ] 如有根级tsup配置字段则重命名
- [ ] 运行tsdown并验证构建输出
- [ ] 为用户推荐tsdown新增功能