mirror of
https://github.com/h-sphere/sql-seal-charts.git
synced 2026-07-22 05:37:34 +00:00
37 lines
648 B
JavaScript
37 lines
648 B
JavaScript
|
|
import esbuild from "esbuild";
|
||
|
|
import process from "process";
|
||
|
|
import builtins from "builtin-modules";
|
||
|
|
|
||
|
|
const banner =
|
||
|
|
`/*
|
||
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
|
|
*/
|
||
|
|
`;
|
||
|
|
|
||
|
|
const prod = (process.argv[2] === "production");
|
||
|
|
|
||
|
|
const context = await esbuild.context({
|
||
|
|
banner: {
|
||
|
|
js: banner,
|
||
|
|
},
|
||
|
|
entryPoints: ["src/main.ts"],
|
||
|
|
bundle: true,
|
||
|
|
external: [
|
||
|
|
"obsidian",
|
||
|
|
"electron",
|
||
|
|
...builtins,
|
||
|
|
],
|
||
|
|
format: "cjs",
|
||
|
|
target: "es2016",
|
||
|
|
logLevel: "info",
|
||
|
|
sourcemap: prod ? false : "inline",
|
||
|
|
treeShaking: true,
|
||
|
|
outfile: "main.js",
|
||
|
|
});
|
||
|
|
|
||
|
|
if (prod) {
|
||
|
|
await context.rebuild();
|
||
|
|
process.exit(0);
|
||
|
|
} else {
|
||
|
|
await context.watch();
|
||
|
|
}
|