-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
30 lines (27 loc) · 1.11 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
import pluginReplace from "@rollup/plugin-replace";
import { terser as pluginTerser } from "rollup-plugin-terser";
const nyes = /([Yy][Ee]?[Ss]?)|([Tt][Rr]?[Uu]?[Ee]?)/;
const ALL = process.env.ALL && nyes.test(process.env.ALL);
const conf = (file, format, { prod, min }) => ({
input: "build/index.js",
output: {
file,
format,
name: "webglutenfree",
sourcemap: true,
},
plugins: [
prod && pluginReplace({
"process.env.NODE_ENV": JSON.stringify("production"),
}),
min && pluginTerser(),
].filter(plugin => !!plugin),
});
export default [
conf("dist/webglutenfree.js", "es", { prod: false, min: false }),
ALL && conf("dist/webglutenfree.prod.js", "es", { prod: true, min: false }),
ALL && conf("dist/webglutenfree.prod.min.js", "es", { prod: true, min: true }),
conf("dist/webglutenfree.umd.js", "umd", { prod: false, min: false }),
ALL && conf("dist/webglutenfree.umd.prod.js", "umd", { prod: true, min: false }),
ALL && conf("dist/webglutenfree.umd.prod.min.js", "umd", { prod: true, min: true }),
].filter(build => !!build);