-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.js
36 lines (28 loc) · 921 Bytes
/
rollup.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
// rollup.js
import co from "co";
import filesize from "rollup-plugin-filesize";
import { rollup } from "rollup";
import { default as baseConfig, genConfig, uglifier } from "./rollup.config";
co( function* rollupPackage () {
let bundle, minifiedBundle;
// Create a base bundle
bundle = yield rollup( baseConfig );
console.log("Generated base bundle");
// Write to file
yield bundle.write( baseConfig );
console.log(`Wrote base bundle to ${ baseConfig.dest }`);
// Create minified bundle
let prodConfig = genConfig( true );
minifiedBundle = yield rollup( Object.assign( prodConfig, {
// Set cache to generated bundle for optimization
cache: bundle,
plugins: [
uglifier,
filesize()
]
}) );
console.log("Generated minified bundle");
// Write to file
yield minifiedBundle.write( prodConfig );
console.log(`Wrote minified bundle to ${ prodConfig.dest }`);
});