-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathrollup.config.js
62 lines (58 loc) · 1.31 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
/**
* Rollup Configuration
*
* This configuration builds AppRun's ESM bundles with the following features:
* - Minification (controlled by MINIFY env var, defaults to true)
* - Sourcemaps (enabled by default)
* - Property mangling for properties starting with '__'
*
* Usage:
* - Default build (minified): rollup -c
* - Unminified build: MINIFY=false rollup -c
*/
const terser = require('@rollup/plugin-terser');
const resolve = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
// Control minification via environment variable
const minify = process.env.MINIFY !== 'false';
const plugins = minify ? [
resolve(),
commonjs(),
terser({
module: true,
sourceMap: true, // Enable sourcemap support in terser
mangle: {
properties: {
regex: /^__/,
},
},
})
] : [
resolve(),
commonjs()
];
module.exports = [{
input: 'esm/apprun.js',
output: {
file: 'dist/apprun.esm.js',
format: 'esm',
sourcemap: true
},
plugins,
}, {
input: 'esm/apprun-html.js',
output: {
file: 'dist/apprun-html.esm.js',
format: 'esm',
sourcemap: true
},
plugins
}, {
input: 'esm/apprun-play-html.js',
output: {
file: 'dist/apprun-play-html.esm.js',
format: 'esm',
sourcemap: true
},
plugins
}]