summaryrefslogtreecommitdiffstats
path: root/web/play/build.mjs
blob: 40af07454eb5a27abab2627ec25879d78a7d4f4c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { build, context } from "esbuild";

const watch = process.argv.includes("--watch");

const options = {
  entryPoints: ["src/main.ts"],
  bundle: true,
  outfile: "app.js",
  format: "iife",
  target: ["es2020"],
  minify: !watch,
  sourcemap: watch ? "inline" : false,
  charset: "utf8",
  logLevel: "info",
};

if (watch) {
  const ctx = await context(options);
  await ctx.watch();
} else {
  await build(options);
}