callumalpass_tasknotes/esbuild.config.mjs
Callum Alpass b1c755ddfa Refactor plugin architecture and implement best practices
- Create modular folder structure
- Move classes to dedicated files
- Extract utility functions
- Improve error handling
- Apply Obsidian plugin guidelines
- Use setHeading for section headings
- Use Vault API instead of adapter where possible
- Simplify codebase with fewer console logs
- Update frontmatter processing to use FileManager.processFrontMatter
2025-05-18 11:50:16 +10:00

49 lines
969 B
JavaScript

import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
const banner =
`/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;
const prod = (process.argv[2] === "production");
const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["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();
process.exit(0);
} else {
await context.watch();
}