-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
74 lines (69 loc) · 2.03 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import {babel} from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import dts from 'rollup-plugin-dts';
const babelOptions = {
extensions: ['.js', '.ts'],
babelHelpers: 'bundled'
};
const terserOptions = {output: {comments: 'some'}};
export default [
// esm bundle without dependencies (these are resolved
// and handled by the embedding application)
{
input: 'src/index.ts',
external: [/three.*/, '@probe.gl/stats', 'lru-cache'],
plugins: [
replace({__IS_VITE_BUILD__: 'false', preventAssignment: true}),
typescript({tsconfig: './tsconfig.json'}),
babel({
presets: ['@babel/preset-modules'],
babelrc: false,
extensions: ['.js', '.ts'],
babelHelpers: 'bundled'
}),
terser(terserOptions)
],
output: {
file: 'dist/esa-webgl-globe.esm.js',
sourcemap: true,
format: 'esm'
}
},
// bundle the tile-selection worker with all dependencies
{
input: 'src/tile-selector/tile-selector-worker.ts',
plugins: [
replace({__IS_VITE_BUILD__: false, preventAssignment: true}),
typescript({tsconfig: './tsconfig.json'}),
babel({
presets: ['@babel/preset-modules'],
babelrc: false,
extensions: ['.js', '.ts'],
babelHelpers: 'bundled',
compact: true
}),
nodeResolve(),
terser(terserOptions)
],
output: {
file: 'dist/tile-selector-worker.js',
format: 'umd',
sourcemap: true
}
},
// create single .d.ts files for both entrypoints
{
input: './dist/types/src/index.d.ts',
output: [{file: 'dist/esa-webgl-globe.d.ts', format: 'es'}],
plugins: [dts()]
},
{
input: './dist/types/src/tile-selector/tile-selector-worker.d.ts',
output: [{file: 'dist/tile-selector-worker.d.ts', format: 'es'}],
plugins: [dts()]
}
];