/
rollup.config.js
50 lines (46 loc) · 1.04 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
48
49
50
import babel from 'rollup-plugin-babel';
import resolve from "rollup-plugin-node-resolve";
import uglify from 'rollup-plugin-uglify';
const input = 'src/index.js';
const output = {
file: 'dist/components.js',
format: 'umd',
globals: {
react: 'React',
emotion: 'Emotion',
'react-emotion': 'ReactEmotion',
'prop-types': 'PropTypes'
},
name: 'OpiComponents',
sourcemap: true
};
const plugins = [
babel(),
resolve()
];
const external = ['react', 'emotion', 'react-emotion', 'prop-types'];
export default [
{
input,
output
},
{
input,
output: Object.assign({}, output, {
file: 'dist/components-es.js',
format: 'es'
})
}
]
.map(config => Object.assign(config, { external, plugins }))
.reduce((merged, config) => {
return merged.concat([
config,
Object.assign({}, config, {
output: Object.assign({}, config.output, {
file: config.output.file.replace(/\.js$/, '.min.js')
}),
plugins: config.plugins.concat(uglify())
})
]);
}, []);