-
Notifications
You must be signed in to change notification settings - Fork 18
/
rollup.config.mjs
57 lines (55 loc) · 1.25 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
50
51
52
53
54
55
56
57
import typescript from "rollup-plugin-typescript2";
import { uglify } from "rollup-plugin-uglify";
import copy from "rollup-plugin-copy";
import { nodeResolve } from "@rollup/plugin-node-resolve";
const bundles = [
{
name: "blobs",
entry: "public/legacy.ts",
types: "public/legacy.d.ts",
output: ".",
},
{
name: "blobs",
entry: "public/legacy.ts",
types: "public/legacy.d.ts",
output: "v1",
},
{
name: "blobs2",
entry: "public/blobs.ts",
types: "public/blobs.d.ts",
output: "v2",
},
{
name: "blobs2Animate",
entry: "public/animate.ts",
types: "public/animate.d.ts",
output: "v2/animate",
},
];
export default ["es", "umd"].flatMap((format) =>
bundles.map((bundle) => ({
input: bundle.entry,
output: {
file: bundle.output + `/index${format == "es" ? ".module" : ""}.js`,
format: format,
name: bundle.name,
sourcemap: true,
},
plugins: [
nodeResolve(),
typescript({ cacheRoot: "./node_modules/.cache/rpt2" }),
uglify(),
copy({
hook: "writeBundle",
targets: [{
src: bundle.types,
dest: bundle.output,
rename: "index.d.ts",
}],
verbose: true,
}),
],
}))
);