mirror of
https://github.com/ttusk/leif.git
synced 2026-07-22 08:32:51 +00:00
24 lines
551 B
JavaScript
24 lines
551 B
JavaScript
import esbuild from "esbuild";
|
|
import process from "node:process";
|
|
|
|
const isProduction = process.argv[2] === "production";
|
|
|
|
const context = await esbuild.context({
|
|
entryPoints: ["src/main.ts"],
|
|
bundle: true,
|
|
external: ["obsidian", "electron", "@codemirror/*"],
|
|
format: "cjs",
|
|
target: "es2020",
|
|
sourcemap: isProduction ? false : "inline",
|
|
minify: isProduction,
|
|
treeShaking: true,
|
|
outfile: "main.js",
|
|
logLevel: "info"
|
|
});
|
|
|
|
if (isProduction) {
|
|
await context.rebuild();
|
|
await context.dispose();
|
|
} else {
|
|
await context.watch();
|
|
}
|