-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathbuild.js
41 lines (34 loc) · 877 Bytes
/
build.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
const rollup = require('rollup');
const resolve = require('rollup-plugin-node-resolve');
const babel = require('rollup-plugin-babel');
const {uglify} = require('rollup-plugin-uglify');
const chalk = require('chalk');
const rmrf = require('rmrf');
rmrf('dist/');
// see below for details on the options
const inputOptions = {
input: 'src/Idb.js',
plugins:[
resolve(),
babel({
exclude: 'node_modules/**'
}),
uglify()
]
};
const outputOptions = {
file: 'dist/Idb.js',
format: 'umd',
name: 'Idb'
};
async function build() {
// create a bundle
const bundle = await rollup.rollup(inputOptions);
// generate code and a sourcemap
const { code, map } = await bundle.generate(outputOptions);
// or write the bundle to disk
await bundle.write(outputOptions);
}
build().then(()=>{
console.log(chalk.green('打包完成!^-^\n'))
});