-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathrollup.config.js
More file actions
66 lines (61 loc) · 1.31 KB
/
rollup.config.js
File metadata and controls
66 lines (61 loc) · 1.31 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
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import terser from "@rollup/plugin-terser";
import dts from "rollup-plugin-dts";
const plugins = [
resolve(),
commonjs(),
typescript({
compilerOptions: {
declaration: false,
outDir: undefined,
},
}),
];
const entries = [
{ name: "index", input: "src/index.ts" },
{ name: "lnclient", input: "src/lnclient/index.ts" },
{ name: "nwc", input: "src/nwc/index.ts" },
{ name: "oauth", input: "src/oauth/index.ts" },
{ name: "webln", input: "src/webln/index.ts" },
];
const subBundles = entries.flatMap(({ name, input }) => [
{
input,
plugins,
output: {
file: `dist/esm/${name}.js`,
format: "esm",
sourcemap: true,
},
},
{
input,
plugins,
output: {
file: `dist/cjs/${name}.cjs`,
format: "cjs",
sourcemap: true,
},
},
{
input,
plugins: [dts()],
output: {
file: `dist/types/${name}.d.ts`,
format: "es",
},
},
]);
const umdBundle = {
input: "src/index.ts",
plugins: [...plugins, terser()],
output: {
file: "dist/alby-sdk.umd.js",
format: "umd",
name: "AlbySdk",
sourcemap: true,
},
};
export default [...subBundles, umdBundle];