mirror of
https://github.com/sbuffkin/hexmaker.git
synced 2026-07-22 14:30:24 +00:00
Icons are now embedded at build time via esbuild dataurl loader, so they work for all install methods without requiring a separate icons/ folder in the release assets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
42 lines
920 B
JavaScript
42 lines
920 B
JavaScript
import esbuild from "esbuild";
|
|
import process from "process";
|
|
import { createRequire } from "module";
|
|
|
|
const require = createRequire(import.meta.url);
|
|
const pkg = require("./package.json");
|
|
const fs = require("fs");
|
|
|
|
const production = process.argv[2] === "production";
|
|
|
|
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 = production;
|
|
const outDir = ".";
|
|
const outFile = "main.js";
|
|
|
|
const context = await esbuild.context({
|
|
banner: {
|
|
js: banner,
|
|
},
|
|
entryPoints: ["main.ts"],
|
|
bundle: true,
|
|
external: ["obsidian"],
|
|
format: "cjs",
|
|
target: "es2018",
|
|
logLevel: "info",
|
|
sourcemap: prod ? false : "inline",
|
|
treeShaking: true,
|
|
outfile: `${outDir}/${outFile}`,
|
|
loader: { ".md": "text", ".png": "dataurl" },
|
|
});
|
|
|
|
if (prod) {
|
|
await context.rebuild();
|
|
process.exit(0);
|
|
} else {
|
|
await context.watch();
|
|
}
|