-
Notifications
You must be signed in to change notification settings - Fork 69
/
.rollup.js
64 lines (61 loc) · 1.36 KB
/
.rollup.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
import builtins from 'rollup-plugin-node-builtins'
import globals from 'rollup-plugin-node-globals'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import { eslint } from 'rollup-plugin-eslint'
import uglify from 'rollup-plugin-uglify'
import filesize from 'rollup-plugin-filesize'
import json from 'rollup-plugin-json'
import less from 'rollup-plugin-less'
import sourcemaps from 'rollup-plugin-sourcemaps'
let uglify_opts = {
compress: {
passes: 2,
//hoist_funs: true,
//hoist_vars: true,
//toplevel: true,
},
}
if (process.env.NODE_ENV === 'production') {
uglify_opts.mangle = {
toplevel: true,
/*properties: {
reserved: ['on', 'catch', 'next', 'reslove', 'reject']
},*/
}
} else {
uglify_opts.compress.drop_debugger = false;
uglify_opts.output = {
beautify: true,
}
}
export default {
input: 'src/webapp.js',
output: {
file: 'public/webapp.bundle.js',
format: 'iife',
name: 'MiBand'
},
sourceMap: true,
plugins: [
eslint({
throwOnError: true,
exclude: [ './node_modules/**', './src/styles/**' ]
}),
resolve({
jsnext: true,
main: true,
browser: true,
}),
json(),
commonjs(),
globals(),
builtins(),
//uglify(uglify_opts),
filesize(),
less({
insert: true
}),
sourcemaps()
]
}