// Bundle the typed Preact app and its standalone inference worker. // Usage: node site/bundle.mjs OUT_DIR. No environment variables are read. import { build } from "esbuild"; import { fileURLToPath } from "node:url"; import { resolve } from "node:path"; const root = fileURLToPath(new URL("..", import.meta.url)); if (process.argv.length !== 3) throw new Error("Usage: node site/bundle.mjs OUT_DIR"); await build({ absWorkingDir: root, entryPoints: { main: "web/main.tsx", brain: "web/brain.ts" }, outdir: resolve(process.argv[2]), bundle: true, format: "esm", platform: "browser", target: "es2022", minify: true, sourcemap: true, legalComments: "eof", // No split chunks: the offline resource manifest is main.js plus brain.js. splitting: false, });