anshuman-ecc-eth_hm-obsidian/esbuild.config.mjs
anshuman-ecc-eth cb90e80af0 fix: resolve Obsidian review bot issues
- Remove @icp-sdk/auth and @icp-sdk/core from esbuild externals to bundle them
  instead of using require() at runtime
- Fix empty block statements in auth.ts storage methods
- Fix promise handling in token-modal.ts copy button onClick
2026-04-20 05:43:08 +00:00

49 lines
985 B
JavaScript

import esbuild from "esbuild";
import process from "process";
import { builtinModules } from 'node:module';
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: ["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",
...builtinModules],
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();
}