-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
44 lines (39 loc) · 1.03 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
import babel from 'rollup-plugin-babel';
/* eslint-disable import/extensions */
import babelrc from 'babelrc-rollup';
/* eslint-enable import/extensions */
const pkg = require('./package.json');
const external = Object.keys(pkg.dependencies || {});
const entry = 'src/mtgio.js';
// my hacky fix to: https://github.com/eventualbuddha/babelrc-rollup/issues/6
const rc = babelrc();
const doesNotAcceptOptions = ['stage-0'];
const acceptsOptionModules = ['es2015'];
rc.presets.forEach((preset, i) => {
if (doesNotAcceptOptions.indexOf(preset[0]) > -1) {
rc.presets[i] = preset[0];
} else if (acceptsOptionModules.indexOf(preset[0]) === -1) {
delete preset[1].modules; // eslint-disable-line
}
});
// console.log(JSON.stringify(rc, null, 2));
export default {
entry,
external,
plugins: [
babel(rc),
],
targets: [
{
format: 'es',
dest: pkg['jsnext:main'],
sourceMap: true,
},
{
format: 'umd',
dest: pkg.main,
moduleName: pkg['umd:moduleName'],
sourceMap: true,
},
],
};