pomerium/ui/scripts/esbuild.ts
Caleb Doxsey ab388211f2
core/ui: improve frontend build size (#5109)
* core/ui: improve frontend build size

* remove luxon

* add lodash

* remove console.log

* only generate sourcemap when watching
2024-05-09 07:10:00 -06:00

28 lines
568 B
TypeScript

/// <reference types="node" />
import { BuildOptions, build, context } from "esbuild";
async function run() {
const watching = process.argv.includes("--watch");
const cfg: BuildOptions = {
entryPoints: ["src/index.tsx"],
bundle: true,
outdir: "dist",
sourcemap: watching ? "inline" : false,
minify: !watching,
logLevel: "info",
loader: {
".svg": "dataurl",
".woff": "dataurl",
".woff2": "dataurl",
},
};
if (watching) {
await (await context(cfg)).watch();
} else {
await build(cfg);
}
}
run();