-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathrollup.config.csp.ts
More file actions
26 lines (22 loc) · 929 Bytes
/
rollup.config.csp.ts
File metadata and controls
26 lines (22 loc) · 929 Bytes
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
import {plugins} from './build/rollup_plugins.js';
import banner from './build/banner.js';
import type {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 config = (input: InputOption, file: string, format: ModuleFormat): RollupOptions => ({
input,
output: {
name: 'mapboxgl',
file,
format,
sourcemap: true,
indent: false,
banner
},
treeshake: {preset: 'recommended', moduleSideEffects: (id) => !id.endsWith('devtools.ts')},
plugins: plugins({minified: true, production: true, keepClassNames: true, test: false, mode: 'production'})
});
export default [
config('src/index.ts', 'dist/mapbox-gl-csp.js', 'umd'),
config('src/source/worker.ts', 'dist/mapbox-gl-csp-worker.js', 'iife')
];