-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
85 lines (83 loc) · 1.91 KB
/
rollup.config.js
File metadata and controls
85 lines (83 loc) · 1.91 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import typescript from 'rollup-plugin-typescript2';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { fileURLToPath } from 'node:url'
import * as path from 'node:path';
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default [{
// 入口文件
input: 'src/Lox.ts',
// 输出配置
output: [
{
// 输出文件路径
file: 'dist/src/Lox.cjs',
// 输出格式为 CommonJS
format: 'commonjs',
// 生成 sourcemap 文件
sourcemap: true
},
{
// 输出文件路径
file: 'dist/src/Lox.esm.js',
// 输出格式为 ES 模块
format: 'esm',
// 生成 sourcemap 文件
sourcemap: true
}
],
// 插件配置
plugins: [
// 处理 TypeScript 文件
typescript({
useTsconfigDeclarationDir: true,
tsconfig: path.resolve(__dirname, './tsconfig.json'),
}),
// 解析第三方模块
resolve(),
// 将 CommonJS 模块转换为 ES6 模块
commonjs()
]
},{
input: 'tools/generateAST.ts',
output: [
{
file: 'dist/tools/generateAST.cjs',
format: 'commonjs',
sourcemap: true,
}
],
// 插件配置
plugins: [
// 处理 TypeScript 文件
typescript({
useTsconfigDeclarationDir: true,
tsconfig: path.resolve(__dirname, './tsconfig.json'),
}),
// 解析第三方模块
resolve(),
// 将 CommonJS 模块转换为 ES6 模块
commonjs()
]
},{
input: 'src/Expr.ts',
output: [
{
file: 'dist/src/Expr.cjs',
format: 'commonjs',
sourcemap: true,
}
],
// 插件配置
plugins: [
// 处理 TypeScript 文件
typescript({
useTsconfigDeclarationDir: true,
tsconfig: path.resolve(__dirname, './tsconfig.json'),
}),
// 解析第三方模块
resolve(),
// 将 CommonJS 模块转换为 ES6 模块
commonjs()
]
}];