forked from maplibre/maplibre-gl-js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.csp.ts
31 lines (26 loc) · 966 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
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} = process.env;
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)
});
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;