-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathrollup.config.js
43 lines (41 loc) · 1.05 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
import { uglify } from 'rollup-plugin-uglify';
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import nodePolyfills from 'rollup-plugin-polyfill-node';
import { visualizer } from 'rollup-plugin-visualizer';
const isBundleVis = !!process.env.BUNDLE_VIS;
module.exports = [
{
input: 'src/index.ts',
output: {
file: 'dist/g2.min.js',
name: 'G2',
format: 'umd',
sourcemap: false,
},
plugins: [
nodePolyfills(),
resolve(),
commonjs(),
typescript(),
uglify(),
...(isBundleVis ? [visualizer()] : []),
],
},
{
input: 'src/index.ts',
output: {
file: 'dist/g2-lite.min.js',
name: 'G2',
format: 'umd',
sourcemap: false,
globals: {
'@antv/g': 'window.G',
'@antv/g-canvas': 'window.G.Canvas2D',
},
},
external: ['@antv/g', '@antv/g-canvas'],
plugins: [nodePolyfills(), resolve(), commonjs(), typescript(), uglify()],
},
];