mirror of
https://github.com/sonophage/stardust-importer.git
synced 2026-07-22 07:48:44 +00:00
27 lines
713 B
JavaScript
27 lines
713 B
JavaScript
import esbuild from "esbuild";
|
|
import process from "process";
|
|
import { builtinModules } from "node:module";
|
|
|
|
const production = process.argv[2] === "production";
|
|
const builtins = builtinModules.flatMap((m) => [m, `node:${m}`]);
|
|
|
|
const context = await esbuild.context({
|
|
banner: { js: "/* Stardust Importer — Obsidian plugin by Sonophage. */" },
|
|
entryPoints: ["main.ts"],
|
|
bundle: true,
|
|
external: ["obsidian", "electron", ...builtins],
|
|
format: "cjs",
|
|
target: "es2018",
|
|
logLevel: "info",
|
|
sourcemap: production ? false : "inline",
|
|
treeShaking: true,
|
|
outfile: "main.js",
|
|
minify: production
|
|
});
|
|
|
|
if (production) {
|
|
await context.rebuild();
|
|
process.exit(0);
|
|
} else {
|
|
await context.watch();
|
|
}
|