-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
44 lines (36 loc) · 1.17 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
// ------------------------------------------------------------------------------------------
// setup
// ------------------------------------------------------------------------------------------
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';
import buble from 'rollup-plugin-buble';
const pkg = require('./package.json')
const external = Object.keys(pkg.dependencies || {});
function output (file, format = 'umd') {
return {
name: pkg.name.replace(/(^\w|-\w)/g, c => c.replace('-', '').toUpperCase()),
file: 'dist/' + file,
format: format,
exports: 'default',
}
}
// ------------------------------------------------------------------------------------------
// build
// ------------------------------------------------------------------------------------------
const umd = {
input: 'src/main.js',
external: external,
output: output('bundle.js'),
plugins: [
commonjs(),
buble()
]
}
const min = Object.assign({}, umd, {
output: output('bundle.min.js'),
plugins: [...umd.plugins, uglify()]
})
const es = Object.assign({}, umd, {
output: output('bundle.esm.js', 'es')
})
export default [umd, min, es]