-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
43 lines (37 loc) · 1.07 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
// rollup.config.js
import _async from "rollup-plugin-async";
import cleanup from "rollup-plugin-cleanup";
import commonjs from "rollup-plugin-commonjs";
import filesize from "rollup-plugin-filesize";
import flow from "rollup-plugin-flow";
import ignore from "rollup-plugin-ignore";
import resolve from "rollup-plugin-node-resolve";
import uglify from "rollup-plugin-uglify";
import { minify } from "uglify-es";
const prod = process.env.NODE_ENV === "production",
entry = "src/index.js",
moduleName = "Pipes.core";
export const uglifier = uglify({}, minify);
export let cache;
export function genConfig( prod=false ) {
let dest = `dist/pipes.core.es6${ prod ? '.min' : '' }.js`;
return Object.assign({}, {
entry,
moduleName,
dest,
cache,
format: "iife",
exports: "named",
plugins: [
flow(),
commonjs({ include: 'node_modules/**' }),
ignore(["babel-polyfill", "web-streams-polyfill"]),
resolve(),
_async(),
cleanup(),
prod && uglifier,
filesize()
]
} );
}
export default genConfig( prod );