-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
41 lines (40 loc) · 1.11 KB
/
rollup.config.ts
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
import { nodeResolve } from '@rollup/plugin-node-resolve'
import terser from '@rollup/plugin-terser'
import babel from '@rollup/plugin-babel'
import typescript from '@rollup/plugin-typescript'
import pkg from './package.json' assert { type: 'json' }
module.exports = {
input: './src/main.ts',
output: [
{
file: pkg.browser, // 输出路径
format: 'umd', // 输出的模块协议 umd
name: pkg.name,
exports: 'named',
sourcemap: true,
esModule: false,
},
{
file: pkg.module, // 输出路径
format: 'esm', // 输出的模块协议 esm
exports: 'named',
sourcemap: true,
},
{
file: pkg.main, // 输出路径
format: 'cjs', // 输出的模块协议 cjs
exports: 'named',
sourcemap: true,
},
],
plugins: [
nodeResolve(),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**', // 指定哪些文件夹时不进行babel编译的
}),
terser(),
typescript(),
],
external: [], // 表示哪些模块是外部引用, 即使开启了 resolve 这里面的模块仍然是外部引用
}