-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.prod.js
54 lines (51 loc) · 1.19 KB
/
rollup.prod.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
48
49
50
51
52
53
54
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const babel = require('rollup-plugin-babel');
const uglify = require('rollup-plugin-uglify');
const flow = require('rollup-plugin-flow');
const replace = require('rollup-plugin-replace');
const { minify } = require('uglify-es');
const pkg = require('./package.json');
const plugins = [
resolve(),
babel({
exclude: 'node_modules/**',
plugins: ['external-helpers']
}),
flow(),
replace({
'process.env.NODE_ENV': JSON.stringify('production')
}),
commonjs(),
// Since we're using ES modules we need this _hack_
// https://github.com/TrySound/rollup-plugin-uglify#warning
uglify({}, minify)
];
const config = {
banner: `/* react-med-lib version ${pkg.version} */`,
footer: '/* Join our community! https://meetup.com/React-Medellin */',
entry: 'src/index.js',
moduleName: 'ReactMedLib',
targets: [
{
dest: pkg.main,
format: 'umd',
sourceMap: true
},
{
dest: pkg.module,
format: 'es',
sourceMap: true
}
],
external: [
'react',
'styled-components'
],
globals: {
react: 'React',
'styled-components': 'styled-components'
},
plugins
};
module.exports = config;