forked from maplibre/maplibre-gl-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.csp.ts
33 lines (27 loc) · 1021 Bytes
/
rollup.config.csp.ts
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
import {plugins} from './build/rollup_plugins';
import banner from './build/banner';
import {InputOption, ModuleFormat, RollupOptions} from 'rollup';
// a config for generating a special GL JS bundle with static web worker code (in a separate file)
// https://github.com/mapbox/mapbox-gl-js/issues/6058
const {BUILD, MINIFY} = process.env;
const minified = MINIFY === 'true';
const production: boolean = (BUILD !== 'dev');
const outputPostfix: string = production ? '' : '-dev';
const config = (input: InputOption, file: string, format: ModuleFormat): RollupOptions => ({
input,
output: {
name: 'maplibregl',
file,
format,
sourcemap: true,
indent: false,
banner
},
treeshake: production,
plugins: plugins(production, minified)
});
const configs = [
config('src/index.ts', `dist/maplibre-gl-csp${outputPostfix}.js`, 'umd'),
config('src/source/worker.ts', `dist/maplibre-gl-csp-worker${outputPostfix}.js`, 'iife')
];
export default configs;