mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 16:30:17 +02:00
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
This commit is contained in:
parent
d225288ab3
commit
ab388211f2
36 changed files with 358 additions and 297 deletions
|
@ -1,16 +1,28 @@
|
|||
import { build } from "esbuild";
|
||||
/// <reference types="node" />
|
||||
import { BuildOptions, build, context } from "esbuild";
|
||||
|
||||
build({
|
||||
entryPoints: ["src/index.tsx"],
|
||||
bundle: true,
|
||||
outfile: "dist/index.js",
|
||||
sourcemap: "inline",
|
||||
watch: process.argv.includes("--watch"),
|
||||
minify: !process.argv.includes("--watch"),
|
||||
logLevel: "info",
|
||||
loader: {
|
||||
".svg": "dataurl",
|
||||
".woff": "dataurl",
|
||||
".woff2": "dataurl",
|
||||
},
|
||||
});
|
||||
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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue