-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.umd.config.js
48 lines (44 loc) · 1.3 KB
/
rollup.umd.config.js
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 typescript from 'rollup-plugin-typescript2'
// import { nodeResolve } from '@rollup/plugin-node-resolve'
// import commonjs from '@rollup/plugin-commonjs'
// import json from '@rollup/plugin-json'
// import sass from 'rollup-plugin-sass'
// // import excludeDependenciesFromBundle from 'rollup-plugin-exclude-dependencies-from-bundle'
import replace from '@rollup/plugin-replace'
import terser from '@rollup/plugin-terser'
import baseConfig from './rollup.config'
// const overrides = {
// compilerOptions: {
// declaration: true
// },
// exclude: ['src/**/*.test.tsx', 'src/**/*.stories.tsx', 'src/**/*.stories.mdx']
// }
const config = {
...baseConfig,
output: [
{
// script 引入后的全局名称
name: 'vald',
file: 'dist/index.umd.js',
format: 'umd',
// 导出的是全局变量命名的一个方式
exports: 'named',
// 设置排除的包在cdn引入时的全局变量名
globals: {
'react': 'React',
'react-dom': 'ReactDOM',
'axios': 'Axios',
},
plugins: [terser()],
},
],
plugins: [
replace({
'preventAssignment': true,
'process.env.NODE_ENV': JSON.stringify('production'),
}),
...baseConfig.plugins,
],
external: ['react', 'react-dom', 'axios'],
}
export default config