-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.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 pkg from './package.json';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
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.ts',
output: {
file: filename,
format: 'umd',
name: 'MaplibreGraticule',
sourcemap: true
},
external: [
// ...Object.keys(pkg.peerDependencies),
'fs',
'path',
],
plugins: [
resolve(),
typescript(
{
tsconfig: 'tsconfig.json',
declaration: true,
declarationDir: 'dist',
}
),
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 }),
];