forked from qrohlf/trianglify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
28 lines (27 loc) · 1.21 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
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import babel from '@rollup/plugin-babel'
import { terser } from 'rollup-plugin-terser'
import bundleSize from 'rollup-plugin-bundle-size'
import pkg from './package.json'
export default [
{ // build for node & module bundlers
input: 'src/trianglify.js',
external: ['chroma-js', 'delaunator', 'canvas'],
plugins: [babel({ babelHelpers: 'bundled' }), bundleSize()],
output: { file: pkg.main, format: 'cjs' }
},
{
// build minified bundle to be used standalone for browser use
// note: // chroma.js weighs 40k minified, a smaller solution would be nice
input: 'src/trianglify.js',
plugins: [terser({ output: { comments: false } }), resolve({ browser: true }), commonjs(), babel({ babelHelpers: 'bundled' }), bundleSize()],
output: { file: 'dist/trianglify.bundle.js', format: 'umd', name: 'trianglify' }
},
{
// build non-minified bundle to be used for debugging
input: 'src/trianglify.js',
plugins: [resolve({ browser: true }), commonjs(), babel({ babelHelpers: 'bundled' }), bundleSize()],
output: { file: 'dist/trianglify.bundle.debug.js', format: 'umd', name: 'trianglify' }
}
]