forked from adamritter/nostr-relaypool-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
executable file
·48 lines (42 loc) · 980 Bytes
/
build.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
#!/usr/bin/env node
import {build} from "esbuild";
let common = {
entryPoints: ["index.ts"],
bundle: true,
sourcemap: "external",
};
build({
...common,
outfile: "lib/nostr-relaypool.esm.js",
format: "esm",
packages: "external",
}).then(() => console.log("esm build success."));
build({
...common,
outfile: "lib/nostr-relaypool.cjs",
format: "cjs",
packages: "external",
}).then(() => console.log("cjs build success."));
build({
...common,
outfile: "lib/nostr-relaypool.bundle.js",
format: "iife",
globalName: "NostrRelayPool",
define: {
window: "self",
global: "self",
process: '{"env": {}}',
},
}).then(() => console.log("standalone build success."));
// build worker
build({
...common,
outfile: "lib/nostr-relaypool.worker.js",
format: "esm",
target: "es2018",
loader: {
".ts": "ts",
},
entryPoints: ["relay-pool.worker.ts"],
external: ["@nostr/core"],
}).then(() => console.log("worker build success."));