diff options
Diffstat (limited to '')
| -rw-r--r-- | web/play/build.mjs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/web/play/build.mjs b/web/play/build.mjs new file mode 100644 index 0000000..40af074 --- /dev/null +++ b/web/play/build.mjs | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | import { build, context } from "esbuild"; | ||
| 2 | |||
| 3 | const watch = process.argv.includes("--watch"); | ||
| 4 | |||
| 5 | const options = { | ||
| 6 | entryPoints: ["src/main.ts"], | ||
| 7 | bundle: true, | ||
| 8 | outfile: "app.js", | ||
| 9 | format: "iife", | ||
| 10 | target: ["es2020"], | ||
| 11 | minify: !watch, | ||
| 12 | sourcemap: watch ? "inline" : false, | ||
| 13 | charset: "utf8", | ||
| 14 | logLevel: "info", | ||
| 15 | }; | ||
| 16 | |||
| 17 | if (watch) { | ||
| 18 | const ctx = await context(options); | ||
| 19 | await ctx.watch(); | ||
| 20 | } else { | ||
| 21 | await build(options); | ||
| 22 | } | ||
