-
-
Notifications
You must be signed in to change notification settings - Fork 100
/
rollup.config.js
47 lines (45 loc) · 1.19 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
45
46
47
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
import replace from 'rollup-plugin-replace';
import resolve from 'rollup-plugin-node-resolve';
import sourceMaps from 'rollup-plugin-sourcemaps';
import uglify from 'rollup-plugin-uglify';
const shared = {
entry: `compiled/index.js`,
sourceMap: true,
external: ['react'],
globals: {
react: 'React',
},
exports: 'named',
};
export default [
Object.assign({}, shared, {
moduleName: 'RenderProps',
format: 'umd',
dest:
process.env.NODE_ENV === 'production'
? './dist/index.umd.min.js'
: './dist/index.umd.js',
plugins: [
resolve(),
replace({
exclude: 'node_modules/**',
'process.env.NODE_ENV': JSON.stringify(
process.env.NODE_ENV || 'development'
),
}),
commonjs(),
sourceMaps(),
process.env.NODE_ENV === 'production' && filesize(),
process.env.NODE_ENV === 'production' && uglify(),
],
}),
Object.assign({}, shared, {
targets: [
{ dest: 'dist/index.es6.js', format: 'es' },
{ dest: 'dist/index.js', format: 'cjs' },
],
plugins: [resolve(), sourceMaps()],
}),
];