forked from GoogleChromeLabs/comlink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
52 lines (49 loc) · 1.63 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
import typescript from "rollup-plugin-typescript2";
import { terser } from "rollup-plugin-terser";
function config({ format, minify, input, ext = "js" }) {
const dir = `dist/${format}/`;
const minifierSuffix = minify ? ".min" : "";
return {
input: `./src/${input}.ts`,
output: {
name: "Comlink",
file: `${dir}/${input}${minifierSuffix}.${ext}`,
format,
sourcemap: true
},
plugins: [
typescript({
clean: true,
typescript: require("typescript"),
tsconfigOverride: {
compilerOptions: {
sourceMap: true
},
// Don’t ask. Without this, the typescript plugin is convinced
// to create subfolders and misplace the .d.ts files.
files: ["./src/comlink.ts", "./src/protocol.ts"]
}
}),
minify
? terser({
sourcemap: true,
compress: true,
mangle: true
})
: undefined
].filter(Boolean)
};
}
require("rimraf").sync("dist");
export default [
{ input: "comlink", format: "esm", minify: false, ext: "mjs" },
{ input: "comlink", format: "esm", minify: true, ext: "mjs" },
{ input: "comlink", format: "esm", minify: false },
{ input: "comlink", format: "esm", minify: true },
{ input: "comlink", format: "umd", minify: false },
{ input: "comlink", format: "umd", minify: true },
{ input: "node-adapter", format: "esm", minify: false, ext: "mjs" },
{ input: "node-adapter", format: "esm", minify: true, ext: "mjs" },
{ input: "node-adapter", format: "umd", minify: false },
{ input: "node-adapter", format: "umd", minify: true }
].map(config);