mirror of
https://github.com/grub-basket/SP.git
synced 2026-07-22 07:46:27 +00:00
23 lines
476 B
JavaScript
23 lines
476 B
JavaScript
import esbuild from "esbuild";
|
|
|
|
const prod = process.argv[2] === "production";
|
|
|
|
const ctx = await esbuild.context({
|
|
entryPoints: ["src/main.ts"],
|
|
bundle: true,
|
|
external: ["obsidian", "electron", "@codemirror/*", "@lezer/*"],
|
|
format: "cjs",
|
|
target: "es2020",
|
|
logLevel: "info",
|
|
sourcemap: prod ? false : "inline",
|
|
treeShaking: true,
|
|
minify: prod,
|
|
outfile: "main.js",
|
|
});
|
|
|
|
if (prod) {
|
|
await ctx.rebuild();
|
|
process.exit(0);
|
|
} else {
|
|
await ctx.watch();
|
|
}
|