-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
54 lines (47 loc) · 1.3 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
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
const LIB_DIR = 'lib';
const INPUT = LIB_DIR + '/index.js';
const PLUGINS = [nodeResolve({ preferBuiltins: false, browser: true }), commonjs()];
const MINIFIER = terser({ keep_classnames: true, keep_fnames: true });
const OUTPUT_PREFIX = LIB_DIR + '/browser/millenniumdb-driver';
const COMMON_CONFIG = {
input: INPUT,
plugins: PLUGINS,
};
const IIFE_CONFIG = {
...COMMON_CONFIG,
output: {
file: `${OUTPUT_PREFIX}.js`,
format: 'iife',
sourcemap: false,
name: 'MillenniumDB',
},
};
const ESM_CONFIG = {
...COMMON_CONFIG,
output: {
file: `${OUTPUT_PREFIX}.esm.js`,
format: 'es',
sourcemap: false,
name: 'MillenniumDB',
},
};
const IIFE_MIN_CONFIG = {
...IIFE_CONFIG,
output: {
...IIFE_CONFIG.output,
file: `${OUTPUT_PREFIX}.min.js`,
},
plugins: [...IIFE_CONFIG.plugins, MINIFIER],
};
const ESM_MIN_CONFIG = {
...ESM_CONFIG,
output: {
...ESM_CONFIG.output,
file: `${OUTPUT_PREFIX}.esm.min.js`,
},
plugins: [...ESM_CONFIG.plugins, MINIFIER],
};
export default [IIFE_CONFIG, ESM_CONFIG, IIFE_MIN_CONFIG, ESM_MIN_CONFIG];