mirror of
https://github.com/panatgithub/AnkiHeadingSync.git
synced 2026-07-22 17:10:28 +00:00
44 lines
975 B
JavaScript
44 lines
975 B
JavaScript
import esbuild from "esbuild";
|
|
import process from "node:process";
|
|
import builtins from "builtin-modules";
|
|
|
|
const banner = `/*\nTHIS IS A GENERATED/BUNDLED FILE BY ESBUILD\n*/`;
|
|
|
|
const production = process.argv[2] === "production";
|
|
const outfile = "dist/plugin/main.js";
|
|
|
|
const context = await esbuild.context({
|
|
banner: { js: banner },
|
|
bundle: true,
|
|
entryPoints: ["main.ts"],
|
|
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",
|
|
logLevel: "info",
|
|
minify: production,
|
|
outfile,
|
|
sourcemap: production ? false : "inline",
|
|
target: "es2020",
|
|
treeShaking: true,
|
|
});
|
|
|
|
if (production) {
|
|
await context.rebuild();
|
|
process.exit(0);
|
|
}
|
|
|
|
await context.watch();
|