-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
48 lines (36 loc) · 1.06 KB
/
tsup.config.ts
File metadata and controls
48 lines (36 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { defineConfig } from 'tsup';
const isDevelopment = process.env.NODE_ENV === 'development';
const isProduction = !isDevelopment;
export default defineConfig({
// 多入口点
entry: {
index: 'src/index.ts',
'types/index': 'src/types/index.ts',
'builders/index': 'src/builders/index.ts',
'validators/index': 'src/validators/index.ts',
'utils/index': 'src/utils/index.ts',
'surface/index': 'src/surface/index.ts',
},
// 输出格式:CJS + ESM 双格式
format: ['cjs', 'esm'],
// 目标环境:ES2020
target: 'es2020',
// 生成类型定义
dts: {
resolve: true, // 自动解析类型依赖
},
// 代码分割:库包不需要
splitting: false,
// 源码映射策略
sourcemap: !isProduction || process.env.ENABLE_SOURCEMAP === 'true',
// 压缩策略:始终启用压缩(发布库需要)
minify: true,
// 清理输出目录
clean: true,
// Tree-shaking
treeshake: true,
// 输出目录
outDir: 'dist',
// 构建完成回调
onSuccess: 'echo "✅ @zhama/a2ui-core build completed"',
});