Skip to content

Commit 4b0150c

Browse files
committed
Readd esbuild.config.mjs
1 parent 5cd631b commit 4b0150c

File tree

2 files changed

+49
-2386
lines changed

2 files changed

+49
-2386
lines changed

esbuild.config.mjs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import esbuild from "esbuild";
2+
import process from "process";
3+
import builtins from "builtin-modules";
4+
5+
const banner =
6+
`/*
7+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
8+
if you want to view the source, please visit the github repository of this plugin
9+
*/
10+
`;
11+
12+
const prod = (process.argv[2] === "production");
13+
14+
const context = await esbuild.context({
15+
banner: {
16+
js: banner,
17+
},
18+
entryPoints: ["main.ts"],
19+
bundle: true,
20+
external: [
21+
"obsidian",
22+
"electron",
23+
"@codemirror/autocomplete",
24+
"@codemirror/collab",
25+
"@codemirror/commands",
26+
"@codemirror/language",
27+
"@codemirror/lint",
28+
"@codemirror/search",
29+
"@codemirror/state",
30+
"@codemirror/view",
31+
"@lezer/common",
32+
"@lezer/highlight",
33+
"@lezer/lr",
34+
...builtins],
35+
format: "cjs",
36+
target: "es2018",
37+
logLevel: "info",
38+
sourcemap: prod ? false : "inline",
39+
treeShaking: true,
40+
outfile: "main.js",
41+
minify: prod,
42+
});
43+
44+
if (prod) {
45+
await context.rebuild();
46+
process.exit(0);
47+
} else {
48+
await context.watch();
49+
}

0 commit comments

Comments
 (0)