-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
43 lines (37 loc) · 878 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
43
import babelrc from 'babelrc-rollup'
import babel from 'rollup-plugin-babel'
import uglify from 'rollup-plugin-uglify'
import _isEqual from 'lodash/isEqual'
const pkg = require('./package.json')
const external = Object.keys(pkg.dependencies)
const config = babelrc({ addExternalHelpersPlugin: false })
const whiteList = ['es2015']
config.presets = config.presets.map(([name, config]) => {
if (!whiteList.includes(name) && _isEqual(config, { modules: false })) {
return name
} else {
return [name, config]
}
})
let plugins = [
babel(config),
uglify()
]
export default {
entry: 'src/index.js',
plugins,
external: external,
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'prop-types': 'PropTypes'
},
targets: [
{
dest: pkg.main,
format: 'umd',
moduleName: 'AvatarEditor',
sourceMap: true
}
]
}