-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathrollup.config.mjs
50 lines (44 loc) · 1.19 KB
/
rollup.config.mjs
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 json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import filesize from 'rollup-plugin-filesize';
const basePlugins = () => [
json(),
resolve({
dedupe: ['gl-matrix'],
mainFields: ['module', 'main'],
}),
];
const configurator = (file, format, plugins = []) => ({
input: 'src/index.js',
output: {
name: 'createScatterplot',
exports: 'named',
format,
file,
globals: {
'pub-sub-es': 'createPubSub',
regl: 'createREGL',
},
interop: 'compat',
},
plugins: [...basePlugins(), ...plugins],
external: ['pub-sub-es', 'regl'],
onwarn: (warning, warn) => {
if (warning.code === 'CIRCULAR_DEPENDENCY') return;
warn(warning);
},
});
const devConfig = configurator('dist/regl-scatterplot.js', 'umd', [
babel({ babelHelpers: 'bundled' }),
filesize(),
]);
const prodConfig = configurator('dist/regl-scatterplot.min.js', 'umd', [
babel({ babelHelpers: 'bundled' }),
terser(),
]);
const esmConfig = configurator('dist/regl-scatterplot.esm.js', 'esm', [
filesize(),
]);
export default [devConfig, prodConfig, esmConfig];