2025-12-17 19:26:42 +00:00
|
|
|
import { build } from "esbuild";
|
|
|
|
|
import { copyFileSync, mkdirSync } from "fs";
|
|
|
|
|
import { dirname } from "path";
|
|
|
|
|
import { fileURLToPath } from "url";
|
2025-12-16 23:52:58 +00:00
|
|
|
|
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
|
|
|
const __dirname = dirname(__filename);
|
|
|
|
|
|
|
|
|
|
// Ensure dist directory exists
|
2025-12-17 19:26:42 +00:00
|
|
|
mkdirSync("dist", { recursive: true });
|
2025-12-16 23:52:58 +00:00
|
|
|
|
|
|
|
|
// Build JavaScript
|
|
|
|
|
await build({
|
2025-12-17 19:26:42 +00:00
|
|
|
entryPoints: ["src/game-viewport.js"],
|
2025-12-16 23:52:58 +00:00
|
|
|
bundle: true,
|
2025-12-17 19:26:42 +00:00
|
|
|
format: "esm",
|
|
|
|
|
outfile: "dist/game-viewport.js",
|
|
|
|
|
sourcemap: true,
|
|
|
|
|
platform: "browser",
|
2025-12-16 23:52:58 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Copy HTML file
|
2025-12-17 19:26:42 +00:00
|
|
|
copyFileSync("src/index.html", "dist/index.html");
|
2025-12-16 23:52:58 +00:00
|
|
|
|
2025-12-17 19:26:42 +00:00
|
|
|
console.log("Build complete!");
|