22 lines
454 B
JavaScript
22 lines
454 B
JavaScript
import esbuild from "esbuild";
|
|
|
|
const isWatch = process.argv.includes("--watch");
|
|
|
|
const buildOptions = {
|
|
entryPoints: ["main.ts"],
|
|
bundle: true,
|
|
platform: "node",
|
|
outfile: "dist/main.js",
|
|
format: "cjs",
|
|
minify: true,
|
|
external: ["obsidian", "child_process"],
|
|
};
|
|
|
|
if (isWatch) {
|
|
const ctx = await esbuild.context(buildOptions);
|
|
await ctx.watch();
|
|
console.log("Watching for changes...");
|
|
} else {
|
|
await esbuild.build(buildOptions);
|
|
}
|