-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
87 lines (86 loc) · 1.75 KB
/
rollup.config.ts
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { defineConfig } from "rollup";
import { fileURLToPath } from "node:url";
import terser from "@rollup/plugin-terser";
import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
export default defineConfig([
{
input: "src/main/index.ts",
output: [
{
file: "main/index.js",
format: "umd",
name: "create-pubsub",
},
{
file: "main/index.mjs",
format: "es",
},
],
plugins: [typescript(), terser()],
},
{
input: "src/main/index.ts",
output: {
file: "main/index.d.ts",
format: "es",
},
plugins: [dts()],
},
{
input: "src/react/index.ts",
output: [
{
file: "react/index.js",
format: "umd",
name: "create-pubsub-react",
globals: {
react: "React",
},
},
{
file: "react/index.mjs",
format: "es",
},
],
external: ["react", "../main", "../immer"],
plugins: [typescript(), terser()],
},
{
input: "src/react/index.ts",
output: {
file: "react/index.d.ts",
format: "es",
},
plugins: [dts()],
},
{
input: "src/immer/index.ts",
output: [
{
file: "immer/index.js",
format: "umd",
name: "create-pubsub-immer",
globals: {
immer: "immer",
[fileURLToPath(new URL("src/main", import.meta.url))]:
"create-pubsub",
},
},
{
file: "immer/index.mjs",
format: "es",
},
],
external: ["immer", "../main"],
plugins: [typescript(), terser()],
},
{
input: "src/immer/index.ts",
output: {
file: "immer/index.d.ts",
format: "es",
},
plugins: [dts()],
},
]);