-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
51 lines (45 loc) · 888 Bytes
/
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
/* global require, module */
const typescript = require("@rollup/plugin-typescript");
const terser = require("rollup-plugin-terser").terser;
const watch = !!process.env.ROLLUP_WATCH;
const config = cfg => {
let out = {
input: "src/remote.ts",
output: {
dir: "dist",
name: "remote",
format: "cjs",
sourcemap: true,
},
plugins: [
typescript({
declaration: true,
declarationDir: "dist/types",
rootDir: "src",
}),
],
};
let outES6 = {
input: "src/remote.ts",
output: {
file: "dist/remote.es6.js",
format: "esm",
sourcemap: true,
},
plugins: [
typescript({
target: "es6",
}),
// terser()
],
};
if (watch) {
// do nothing
} else if (typeof cfg["config-dist"] !== "undefined") {
out.plugins.push(terser());
outES6.plugins.push(terser());
out = [out, outES6];
}
return out;
};
module.exports = config;