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); }