-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrollup.config.js
More file actions
39 lines (39 loc) · 1.04 KB
/
rollup.config.js
File metadata and controls
39 lines (39 loc) · 1.04 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
import nodeResolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
import del from 'rollup-plugin-delete'
export default [
{
input: 'src/index.ts',
output: {
file: 'lib/index.cjs.js',
format: 'cjs',
entryFileNames: '[name].cjs.js'
},
plugins: [
del({
targets: ['lib/**/*']
}),
nodeResolve(), // 查找和打包node_modules中的第三方模块
commonjs(), // 将 CommonJS 转换成 ES2015 模块供 Rollup 处理
typescript({
tsconfig: './tsconfig.json'
}) // 解析TypeScript
]
},
{
input: 'src/index.ts',
output: {
file: 'lib/index.esm.js',
format: 'esm',
entryFileNames: '[name].esm.js'
},
plugins: [
nodeResolve(), // 查找和打包node_modules中的第三方模块
commonjs(), // 将 CommonJS 转换成 ES2015 模块供 Rollup 处理
typescript({
tsconfig: './tsconfig.json'
}) // 解析TypeScript
]
}
]