-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.config.prod.js
54 lines (48 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
import { default as config, outputGenerate } from './rollup.config'
const path = require('path')
import { terser } from "rollup-plugin-terser";
import analyze from 'rollup-plugin-analyzer'
const rimraf = require('rimraf');
const _console = require('console-color-mr')
import copy from 'rollup-plugin-copy'
rimraf('./dist/*', (err) => {
if (err) {
console.error(err)
} else {
console.log('Garbage removal program'.blue)
}
})
config.output = [{
file: path.join(__dirname, './dist/index.js'),
format: 'esm',
name: '$message',
sourcemap: false,
generatedCode: {
arrowFunctions: true
}
}, {
file: path.join(__dirname, './dist/index-umd.js'),
format: 'umd',
name: '$message',
sourcemap: false,
generatedCode: {
arrowFunctions: true
}
}]
config.plugins = config.plugins.concat([
copy({
targets: [
{ src: 'src/assets/icon/iconfont.ttf', dest: 'dist/' },
{ src: 'src/assets/icon/iconfont.woff', dest: 'dist/' },
{ src: 'src/assets/icon/iconfont.woff2', dest: 'dist/' },
]
}),
terser({
compress: {
drop_console: true,
drop_debugger: false,
pure_funcs: ['console.log'] // 移除console
}
}),
])
export default config