-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
28 lines (24 loc) · 774 Bytes
/
build.js
File metadata and controls
28 lines (24 loc) · 774 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
28
import { build } from "esbuild";
async function buildProject() {
try {
await build({
entryPoints: ["./src/index.ts"],
outfile: "dist/build.js",
bundle: true,
platform: "node", // Ensures Node.js standard libs are included
target: ["node14"], // Use `node14` for best compatibility with FiveM
sourcemap: false,
minify: false,
// Avoid bundling native or optional Node.js deps
external: [
"bson", // Used by mongodb
"dns", "fs", "net", "tls", "buffer", "crypto", "stream", "zlib", "http", "https"
],
});
console.log("✅ Build succeeded!");
} catch (error) {
console.error("❌ Build failed:", error);
process.exit(1);
}
}
buildProject();