-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.js
More file actions
67 lines (58 loc) · 1.23 KB
/
Copy pathrollup.config.js
File metadata and controls
67 lines (58 loc) · 1.23 KB
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
/* global require, module */
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import replace from '@rollup/plugin-replace';
const typescript = require("@rollup/plugin-typescript");
const terser = require("rollup-plugin-terser").terser;
const watch = !!process.env.ROLLUP_WATCH;
const base = (output, tsConfig) => ({
input: "src/data.ts",
output,
plugins: [
replace({
COMMERCIAL:true,
EXPIRATION:0,
ZOOM:1,
delimiters: ['', '']
}),
typescript(tsConfig),
resolve(),
commonjs(),
],
});
const config = cfg => {
let out = base({
dir: "dist",
name: "data",
format: "cjs",
sourcemap: true,
},{
declaration: true,
declarationDir: "dist/types",
rootDir: "src",
});
let outES5 = base({
file: "dist/data.es5.js",
name: "data",
format: "iife",
sourcemap: true,
},{
target: "es5",
});
let outES6 = base({
file: "dist/data.es6.js",
format: "esm",
sourcemap: true,
},{
target: "es6",
});
if (watch) {
out = outES5;
} else if (typeof cfg["config-dist"] !== "undefined") {
out = [out, outES6, outES5];
}
if (typeof cfg["config-compressed"] !== "undefined")
out.forEach(a => a.plugins.push(terser()));
return out;
};
module.exports = config;