forked from gaearon/react-side-effect
/
rollup.config.js
43 lines (38 loc) · 1001 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 babel from 'rollup-plugin-babel'
import uglify from 'rollup-plugin-uglify'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
const { BUILD_ENV, BUILD_FORMAT } = process.env
const config = {
input: 'src/index.js',
output: {
name: 'withSideEffect',
globals: {
react: 'React',
},
},
plugins: [
babel({
babelrc: false,
presets: ['react', ['env', { loose: true, modules: false }]],
plugins: ['transform-object-rest-spread', 'transform-class-properties'],
exclude: 'node_modules/**',
}),
],
external: ['shallowequal', 'react', 'exenv'],
}
if (BUILD_FORMAT === 'umd') {
// In the browser build, include our smaller dependencies
// so users only need to include React
config.external = ['react']
config.plugins.push(
resolve(),
commonjs({
include: /node_modules/,
}),
)
}
if (BUILD_ENV === 'production') {
config.plugins.push(uglify())
}
export default config