forked from aidenlx/folder-note-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesbuild.config.mjs
More file actions
33 lines (30 loc) · 795 Bytes
/
esbuild.config.mjs
File metadata and controls
33 lines (30 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import obPlugin from "@aidenlx/esbuild-plugin-obsidian";
import { build } from "esbuild";
const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository
*/
`;
const isProd = process.env.BUILD === "production";
try {
await build({
entryPoints: ["src/fnc-main.ts"],
bundle: true,
watch: !isProd,
platform: "browser",
external: ["obsidian"],
format: "cjs",
mainFields: ["browser", "module", "main"],
banner: { js: banner },
sourcemap: isProd ? false : "inline",
minify: isProd,
define: {
"process.env.NODE_ENV": JSON.stringify(process.env.BUILD),
},
outfile: "build/main.js",
plugins: [obPlugin()],
});
} catch (err) {
console.error(err);
process.exit(1);
}