ttusk_leif/esbuild.config.mjs

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();
}