-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.js
executable file
·71 lines (70 loc) · 1.68 KB
/
rollup.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// import babel from "rollup-plugin-babel";
import resolve from "rollup-plugin-node-resolve";
import json from "rollup-plugin-json";
import commonjs from "rollup-plugin-commonjs";
import replace from "rollup-plugin-replace";//Global replacement
import uglify from "rollup-plugin-uglify";
import serve from "rollup-plugin-serve";
import livereload from "rollup-plugin-livereload";
import postcss from "rollup-plugin-postcss";
//post class
import simplevars from 'postcss-simple-vars';
import nested from 'postcss-nested';
import cssnext from 'postcss-cssnext';
import cssnano from 'cssnano';
import babel from 'rollup-plugin-babel';
export default {
input:"src/index.js",
output:{
file:"./dist/index.min.js",
format:"cjs"
},
plugins: [
commonjs(),
postcss({
extensions:[".css","./scss"],
plugins:[
simplevars(),
nested(),
cssnext({ warnForDuplicates: false, }),
cssnano()
]
}),
resolve({
customResolveOptions: {
moduleDirectory: 'node_modules' // copywith the external
}
}),
babel({
presets: [
[
'es2015',
{
modules: false
}
]
],
exclude: 'node_modules/**'
}),
replace({
ENV:JSON.stringify(process.env.NODE_ENV||"development")//Global replace the ENV
}),
// production uglify
uglify({
output: {
comments: false
},
sourceMap: false,
}),
serve({
open:true,//open the browser
contentBase:"./",
historyApiFallback:true,
host:"localhost",
port:8080
}),
livereload()
],
soucemap:process.env.NODE_ENV==="development"?true:false,
treeshake: true
}