forked from NebulaServices/Dynamic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
esbuild.prod.js
62 lines (54 loc) · 1.3 KB
/
esbuild.prod.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import * as esbuild from "esbuild";
import { copyFile } from "fs/promises";
console.time("esbuild");
const worker = await esbuild.build({
entryPoints: ["lib/worker/index.ts"],
bundle: true,
outfile: "dist/dynamic.worker.js",
format: "iife",
minify: true,
platform: "browser",
sourcemap: true,
target: ["es2020"],
plugins: [],
metafile: true,
});
const handler = await esbuild.build({
entryPoints: ["lib/handler/index.ts"],
bundle: true,
outfile: "dist/dynamic.handler.js",
format: "iife",
minify: true,
platform: "browser",
sourcemap: true,
target: ["es2020"],
plugins: [],
metafile: true,
});
const client = await esbuild.build({
entryPoints: ["lib/client/index.ts"],
bundle: true,
outfile: "dist/dynamic.client.js",
format: "iife",
minify: true,
platform: "browser",
sourcemap: true,
target: ["es2020"],
plugins: [],
metafile: true,
});
const html = await esbuild.build({
entryPoints: ["lib/html/index.ts"],
bundle: true,
outfile: "dist/dynamic.html.js",
format: "iife",
minify: true,
platform: "browser",
sourcemap: true,
target: ["es2020"],
plugins: [],
metafile: true,
});
await copyFile("./lib/dynamic.config.js", "./dist/dynamic.config.js");
console.log(await esbuild.analyzeMetafile((worker.metafile)));
console.timeEnd("esbuild");