-
Notifications
You must be signed in to change notification settings - Fork 25
/
rollup.config.js
executable file
·42 lines (38 loc) · 992 Bytes
/
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
import buble from 'rollup-plugin-buble'
import fileSize from 'rollup-plugin-filesize'
import uglify from 'rollup-plugin-uglify'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
function makeDest (format) {
return `dist/${pkg.name}.${format}${minify ? `.min` : ``}.js`
}
const minify = !!process.env.MINIFY
const pkg = require('./package.json')
let targets = [
{ file: makeDest('cjs'), format: 'cjs' },
{ file: makeDest('umd'), format: 'umd', name: pkg.name }
]
export default {
input: 'src/index.js',
useStrict: false,
sourcemap: minify,
external: ['react', 'prop-types'],
globals: {
react: 'React',
'prop-types': 'PropTypes'
},
plugins: [
resolve({
jsnext: true
// main: false,
// browser: false
}),
commonjs(),
buble(),
minify ? uglify() : {},
minify ? fileSize() : {}
],
output: minify
? targets
: targets.concat([{ file: makeDest('es'), format: 'es' }])
}