-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.mjs
38 lines (35 loc) · 947 Bytes
/
build.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
import { build } from "esbuild";
(async () => {
console.log("Build...");
console.time("Build successfully");
await Promise.all(
[
// Web
{
platform: "browser",
outfile: "dist/browser.js",
},
// Node
{
platform: "node",
format: "cjs",
outfile: "dist/node.cjs",
},
{
platform: "node",
outfile: "dist/node.mjs",
},
].map(async (config) => {
await build({
entryPoints: ["src/index.ts"],
format: "esm",
bundle: true,
minify: true,
keepNames: true,
sourcemap: true,
...config,
}).catch(() => process.exit(1));
}),
);
console.timeEnd("Build successfully");
})();