-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.prod.js
executable file
·74 lines (71 loc) · 1.29 KB
/
rollup.config.prod.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
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
import filesize from 'rollup-plugin-filesize';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-es';
import baseConfig from './rollup.config.base';
import { name, version, author } from './package.json';
// banner
const banner =
`${'/*!\n' + ' * '}${name}.js v${version}\n` +
` * (c) 2017-${new Date().getFullYear()} ${author}\n` +
` * Released under the MIT License.\n` +
` */`;
// 支持输出 []
export default [{
...baseConfig,
// umd development version with sourcemap
output: [
{
file: `dist/${name}.js`,
format: 'umd',
name,
banner,
sourcemap: true
}
],
plugins: [
...baseConfig.plugins,
filesize()
]
}, {
...baseConfig,
// umd with compress version
output: [
{
file: `dist/${name}.min.js`,
format: 'umd',
name,
banner
}
],
plugins: [
...baseConfig.plugins,
uglify(
{
compress: {
drop_console: true
}
},
minify
),
filesize()
]
},{
...baseConfig,
// cjs and esm version
output: [
{
file: `dist/${name}.common.js`,
format: 'cjs',
banner
},
{
file: `dist/${name}.esm.js`,
format: 'es',
banner
}
],
plugins: [
...baseConfig.plugins,
filesize()
]
}]