forked from immerjs/immer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
69 lines (65 loc) · 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
import {minify} from "uglify-es"
import commonjs from "rollup-plugin-commonjs"
import filesize from "rollup-plugin-filesize"
import resolve from "rollup-plugin-node-resolve"
import uglify from "rollup-plugin-uglify"
import babel from "rollup-plugin-babel"
function getConfig(dest, format, ugly) {
const conf = {
input: "src/immer.js",
output: {
exports: "named",
file: dest,
format,
name: "immer",
sourcemap: true
},
plugins: [
resolve({
jsnext: true
}),
commonjs(),
babel({
babelrc: false,
presets: [
[
"env",
{
modules: false
}
]
],
plugins: ["external-helpers"]
}),
ugly &&
uglify(
{
warnings: true,
toplevel: true,
sourceMap: true,
mangle: {
properties: false /* {
reserved: [
"module",
"exports",
"default",
"value", // for the esModule = true defintion
"setUseProxies",
"setAutoFreeze"
]
} */
}
},
minify
),
filesize()
].filter(Boolean)
}
return conf
}
const config = [
getConfig("dist/immer.js", "cjs", false),
getConfig("dist/immer.umd.js", "umd", true),
getConfig("dist/immer.module.js", "es", false)
]
export default config