-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.prod.js
79 lines (76 loc) · 1.63 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
75
76
77
78
79
import replace from 'rollup-plugin-replace';
import { uglify } from 'rollup-plugin-uglify';
import { minify } from 'uglify-es';
import { sizeSnapshot } from 'rollup-plugin-size-snapshot';
import baseConfig from './rollup.config.base';
import { name, author, version as packageVersion } from './package.json';
const version = process.env.VERSION || packageVersion;
const exportName = 'Darkli';
const banner = `${'/*!\n'}`
+ ` * ${exportName} v${version}\n`
+ ` * (c) ${new Date().getFullYear()} ${author}\n`
+ ' * Released under the MIT License.\n'
+ ' */';
export default [
// .js, .cjs.js, .esm.js
{
...baseConfig,
output: [
{
file: `dist/${name}.js`,
format: 'umd',
name: exportName,
banner,
sourcemap: true,
},
{
file: `dist/${name}.common.js`,
format: 'cjs',
banner,
},
{
file: `dist/${name}.esm.js`,
format: 'esm',
banner,
},
{
file: `demo/${name}.js`,
format: 'umd',
name: exportName,
banner,
sourcemap: true,
},
],
plugins: [
...baseConfig.plugins,
replace({
__VERSION__: version,
}),
sizeSnapshot(),
],
},
// .min.js
{
...baseConfig,
output: [
{
file: `dist/${name}.min.js`,
format: 'umd',
name: exportName,
banner,
},
],
plugins: [
...baseConfig.plugins,
replace({
__VERSION__: version,
}),
sizeSnapshot(),
uglify({
compress: {
drop_console: true,
},
}, minify),
],
},
];