forked from gbtami/pychess-variants
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesbuild.mjs
More file actions
33 lines (30 loc) · 744 Bytes
/
esbuild.mjs
File metadata and controls
33 lines (30 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import * as esbuild from 'esbuild';
import { compress } from 'esbuild-plugin-compress';
const args = process.argv;
const dev = args.includes("dev");
const prod = args.includes("prod");
if (dev === prod)
throw "There must be one and only one of either 'dev' or 'prod' in the arguments!";
const baseOpts = {
entryPoints: ['./client/main.ts'],
platform: 'browser',
format: 'iife',
target: 'es2020',
bundle: true,
outfile: './static/pychess-variants.js',
};
if (dev) {
await esbuild.build({
...baseOpts,
sourcemap: 'inline',
});
} else {
await esbuild.build({
...baseOpts,
minify: true,
write: false,
plugins: [
compress(),
],
});
}