-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
88 lines (86 loc) · 2.2 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*eslint no-process-env: "off"*/
// Rollup plugins
import babel from "rollup-plugin-babel"
import eslint from "rollup-plugin-eslint"
import resolve from "rollup-plugin-node-resolve"
import commonjs from "rollup-plugin-commonjs"
import replace from "rollup-plugin-replace"
import uglify from "rollup-plugin-uglify"
import postcss from "rollup-plugin-postcss"
import livereload from "rollup-plugin-livereload"
import serve from "rollup-plugin-serve"
import image from "rollup-plugin-img"
// PostCSS plugins
import simplevars from "postcss-simple-vars"
import nested from "postcss-nested"
import cssnext from "postcss-cssnext"
import postcssModules from "postcss-modules"
const cssExportMap = {}
export default {
entry: "src/main.js",
dest: "build/main.min.js",
format: "iife",
sourceMap: "inline",
plugins: [
postcss({
extensions: [".css"],
plugins: [
simplevars(),
nested(),
cssnext(),
postcssModules({
getJSON (id, exportTokens) {
cssExportMap[id] = exportTokens
},
}),
],
getExport (id) {
return cssExportMap[id]
},
}),
commonjs({
include: ["node_modules/**"],
exclude: [
"node_modules/lodash-es/**",
"node_modules/symbol-observable/**",
],
namedExports: {
"node_modules/react/react.js": [
"Children", "Component", "createElement",
],
"node_modules/redux-logger/dist/redux-logger.js": [
"createLogger",
],
},
}),
resolve({
jsnext: true,
main: true,
browser: true,
}),
eslint({
exclude: [
"src/**/*.css",
"src/**/*.png",
"src/**/*.jpg",
"src/**/*.svg",
],
}),
babel({
exclude: "node_modules/**",
}),
image({limit: 1000000}),
replace({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || "development"),
}),
(process.env.NODE_ENV === "production" && uglify()),
(process.env.NODE_ENV !== "production" && livereload({
watch: "build",
})),
(process.env.NODE_ENV !== "production" && serve({
contentBase: "",
host: "localhost",
port: 10001,
})),
],
}