-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.mjs
executable file
·37 lines (34 loc) · 1.03 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
import babel from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
const { BUILD, MINIFY } = process.env;
const minified = MINIFY === 'true';
const production = BUILD === 'production';
function getBuildOutputFile(build, minified) {
switch (build) {
case 'production':
if (minified) return 'dist/mapbox-gl-draw-history.js';
return 'dist/mapbox-gl-draw-history-unminified.js';
default:
return 'dist/mapbox-gl-draw-history-dev.js';
}
}
const outputFile = getBuildOutputFile(BUILD, MINIFY);
export default {
input: './src/index.ts',
output: {
name: 'MapboxDrawHistory',
file: outputFile,
format: 'umd',
sourcemap: production ? true : 'inline',
indent: false,
},
treeshake: production,
plugins: [
typescript(),
resolve({ moduleDirectories: ['node_modules'] }),
minified ? terser() : false,
babel({ extensions: ['.ts'], include: ['src/**/*.ts'] }),
],
};