import { build } from "esbuild"; import { rmSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); rmSync(path.join(__dirname, "main.js"), { force: true }); rmSync(path.join(__dirname, "main.js.map"), { force: true }); await build({ entryPoints: [path.join(__dirname, "src", "main.ts")], bundle: true, outfile: path.join(__dirname, "main.js"), format: "cjs", platform: "browser", target: "es2020", sourcemap: "inline", external: ["obsidian"], logLevel: "info", treeShaking: true, banner: { js: '/* Obsidian plugin bundle: generated by apps/obsidian-plugin/build.mjs */' } });