mirror of
https://github.com/qiuos/linkmind.git
synced 2026-07-22 07:08:17 +00:00
44 lines
975 B
JavaScript
44 lines
975 B
JavaScript
import esbuild from "esbuild";
|
|
import process from "node:process";
|
|
import { builtinModules as builtins } from "node:module";
|
|
|
|
const prod = process.argv[2] === "production";
|
|
|
|
const context = await esbuild.context({
|
|
banner: {
|
|
js: "/* linkmind - Obsidian mind map plugin */"
|
|
},
|
|
entryPoints: ["src/main.ts"],
|
|
bundle: true,
|
|
external: [
|
|
"obsidian",
|
|
"electron",
|
|
"@codemirror/autocomplete",
|
|
"@codemirror/collab",
|
|
"@codemirror/commands",
|
|
"@codemirror/language",
|
|
"@codemirror/lint",
|
|
"@codemirror/search",
|
|
"@codemirror/state",
|
|
"@codemirror/view",
|
|
"@lezer/common",
|
|
"@lezer/highlight",
|
|
"@lezer/lr",
|
|
...builtins
|
|
],
|
|
format: "cjs",
|
|
target: "es2018",
|
|
logLevel: "info",
|
|
sourcemap: prod ? false : "inline",
|
|
treeShaking: true,
|
|
outfile: "main.js",
|
|
minify: prod
|
|
});
|
|
|
|
if (prod) {
|
|
await context.rebuild();
|
|
await context.dispose();
|
|
} else {
|
|
await context.watch();
|
|
console.log("Watching for changes...");
|
|
}
|