-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathrollup.config.js
38 lines (35 loc) · 1.02 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
import json from '@rollup/plugin-json';
import nodeResolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import bundleSize from 'rollup-plugin-bundle-size';
import commonjs from '@rollup/plugin-commonjs';
import pkg from './package.json' with {type: 'json'};
const outputs = [
{
input: 'src/embed.ts',
output: {
file: pkg.exports.default,
format: 'esm',
sourcemap: true,
},
plugins: [nodeResolve(), commonjs(), json(), typescript(), bundleSize()],
external: [...Object.keys(pkg.dependencies), ...Object.keys(pkg.peerDependencies)],
},
{
input: 'src/index.ts',
output: {
file: pkg.unpkg,
format: 'umd',
name: 'vegaEmbed',
sourcemap: true,
globals: {
vega: 'vega',
'vega-lite': 'vegaLite',
},
},
plugins: [nodeResolve(), commonjs(), json(), typescript(), terser(), bundleSize()],
external: ['vega', 'vega-lite'],
},
];
export default outputs;