-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.js
More file actions
27 lines (25 loc) · 786 Bytes
/
build.js
File metadata and controls
27 lines (25 loc) · 786 Bytes
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
import path from "node:path";
import { fileURLToPath } from "node:url";
import { build } from "esbuild";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
try {
await build({
bundle: true,
sourcemap: true,
format: "esm",
target: "esnext",
external: ["__STATIC_CONTENT_MANIFEST", "highlight.js", "nanoid"],
conditions: ["worker", "browser"],
entryPoints: [path.join(__dirname, "src", "index.ts")],
outdir: path.join(__dirname, "dist"),
outExtension: { ".js": ".mjs" },
tsconfig: path.join(__dirname, "tsconfig.build.json"),
loader: {
".html": "text"
}
});
} catch (err) {
console.error(err);
process.exitCode = 1;
}