forked from GoogleChromeLabs/comlink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
49 lines (46 loc) · 1.44 KB
/
rollup.config.mjs
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
import typescript from "@rollup/plugin-typescript";
import terser from "@rollup/plugin-terser";
import { sync } from "rimraf";
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({
tsconfig: "./tsconfig.json",
compilerOptions: {
declaration: true,
declarationDir: ".",
sourceMap: true,
outDir: "dist",
},
}),
minify
? terser({
compress: true,
mangle: true,
})
: undefined,
].filter(Boolean),
};
}
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);