mirror of
https://github.com/owainwilliams/umbPublisher.git
synced 2026-07-22 13:00:24 +00:00
77 lines
1.2 KiB
JavaScript
77 lines
1.2 KiB
JavaScript
import esbuild from "esbuild";
|
|
import process from "process";
|
|
|
|
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: ["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",
|
|
"@types/node",
|
|
"assert",
|
|
"buffer",
|
|
"cluster",
|
|
"crypto",
|
|
"dgram",
|
|
"dns",
|
|
"domain",
|
|
"events",
|
|
"fs",
|
|
"http",
|
|
"https",
|
|
"net",
|
|
"os",
|
|
"path",
|
|
"process",
|
|
"querystring",
|
|
"readline",
|
|
"stream",
|
|
"string_decoder",
|
|
"tls",
|
|
"tty",
|
|
"url",
|
|
"util",
|
|
"vm",
|
|
"zlib"
|
|
],
|
|
format: "cjs",
|
|
target: "es2018",
|
|
logLevel: "info",
|
|
sourcemap: prod ? false : "linked",
|
|
treeShaking: true,
|
|
outfile: "main.js",
|
|
minify: prod,
|
|
sourceRoot: "",
|
|
sourcesContent: true,
|
|
loader:{".svg": "text"},
|
|
});
|
|
|
|
if (prod) {
|
|
await context.rebuild();
|
|
process.exit(0);
|
|
} else {
|
|
await context.watch();
|
|
}
|