const esbuild = require("esbuild");

esbuild
  .build({
    entryPoints: ["src/index.ts"],
    outfile: "dist/index.js",
    bundle: true,
    platform: "node",
    target: "node22",
    format: "cjs",
    minify: true,
    sourcemap: true,
    // better-sqlite3 ships a native .node binding — it can't be bundled,
    // so it stays a real dependency installed alongside the bundle.
    external: ["better-sqlite3"],
  })
  .then(() => {
    console.log("backend bundled -> dist/index.js");
  })
  .catch(() => process.exit(1));
