2025-03-08 15:51:35 +00:00
|
|
|
import esbuild from "esbuild";
|
|
|
|
|
import process from "process";
|
|
|
|
|
import builtins from "builtin-modules";
|
|
|
|
|
|
2025-03-09 15:20:25 +00:00
|
|
|
const banner = `/*
|
2025-03-08 15:51:35 +00:00
|
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
2025-03-09 15:20:25 +00:00
|
|
|
If you want to view the source, please visit the github repository of this plugin
|
|
|
|
|
*/`;
|
2025-03-08 15:51:35 +00:00
|
|
|
|
|
|
|
|
const prod = process.argv[2] === "production";
|
|
|
|
|
|
|
|
|
|
esbuild.build({
|
2025-03-09 15:20:25 +00:00
|
|
|
banner: { js: banner },
|
2025-03-08 15:51:35 +00:00
|
|
|
entryPoints: ["main.ts"],
|
|
|
|
|
bundle: true,
|
2025-03-09 15:20:25 +00:00
|
|
|
external: ["obsidian", "electron", ...builtins],
|
2025-03-08 15:51:35 +00:00
|
|
|
format: "cjs",
|
|
|
|
|
target: "es2018",
|
|
|
|
|
logLevel: "info",
|
|
|
|
|
sourcemap: prod ? false : "inline",
|
|
|
|
|
treeShaking: true,
|
|
|
|
|
outfile: "main.js",
|
2025-03-09 15:20:25 +00:00
|
|
|
loader: {
|
|
|
|
|
".json": "json", // Inline JSON files
|
|
|
|
|
".wasm": "dataurl" // Inline WASM files as data URLs
|
|
|
|
|
}
|
2025-03-08 16:08:13 +00:00
|
|
|
}).catch(() => process.exit(1));
|