-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
44 lines (41 loc) · 967 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
44
/* @flow */
import babel from 'rollup-plugin-babel'
import cleanup from 'rollup-plugin-cleanup'
import flow from 'rollup-plugin-flow'
import gzip from 'rollup-plugin-gzip'
import uglify from 'rollup-plugin-uglify'
import pkg from './package.json'
// Plugin options objects.
const opts = {
// Pass exact config needed for rollup to build cjs.
babel: {
exclude: 'node_modules/**',
babelrc: false, // will not look at local .babelrc
presets: [['env', { loose: true, modules: false }]],
plugins: ['external-helpers']
},
flow: { pretty: true },
gzip: { minSize: 1000 }
}
// Configuration for outputting CJS & Browser Modules.
export default {
input: 'src/index.js',
plugins: [
flow(opts.flow),
babel(opts.babel),
uglify(),
gzip(opts.gzip),
cleanup()
],
output: [
{
file: pkg.main,
format: 'cjs'
},
{
file: pkg.browser,
format: 'umd',
name: 'how-to-open-source'
}
]
}