-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
40 lines (38 loc) · 994 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
import pkg from './package.json';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import { terser } from 'rollup-plugin-terser';
import visualizer from 'rollup-plugin-visualizer';
function bundle(filename, options = {}) {
return {
input: 'src/index.js',
output: {
file: filename,
format: 'umd',
name: 'CytoscapeLasso',
sourcemap: true,
globals: {
'cytoscape': 'cytoscape',
},
},
external: [
...Object.keys(pkg.peerDependencies),
'fs',
'path',
],
plugins: [
resolve(),
commonjs(),
babel({ babelHelpers: 'runtime' }),
options.minimize ? terser() : false,
options.stats ? visualizer({
filename: filename + '.stats.html',
}) : false,
],
};
}
export default [
bundle(pkg.browser.replace('.min', ''), { stats: true }),
bundle(pkg.browser, { minimize: true }),
];