summaryrefslogtreecommitdiffhomepage
path: root/esbuild.config.mjs
diff options
context:
space:
mode:
authorPhillip <[email protected]>2021-10-25 17:45:15 +0200
committerGitHub <[email protected]>2021-10-25 11:45:15 -0400
commit02ac033b15fd158638ecc650cdbd0cea6b94d77a (patch)
tree74eb2cf8f9211f83c5955a8e8eebdbbd3a2e8edc /esbuild.config.mjs
parente013825c21d83103d296ed3bb27d4fad6e040a3c (diff)
downloadai-pulse-obsidian-plugin-02ac033b15fd158638ecc650cdbd0cea6b94d77a.tar.gz
ai-pulse-obsidian-plugin-02ac033b15fd158638ecc650cdbd0cea6b94d77a.zip
Use ESBuild API instead of passing command line arguments (#16)
Diffstat (limited to 'esbuild.config.mjs')
-rw-r--r--esbuild.config.mjs27
1 files changed, 27 insertions, 0 deletions
diff --git a/esbuild.config.mjs b/esbuild.config.mjs
new file mode 100644
index 0000000..d1c1ba2
--- /dev/null
+++ b/esbuild.config.mjs
@@ -0,0 +1,27 @@
+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 visit the plugins github repository
+*/
+`;
+
+const prod = (process.argv[2] === 'production');
+
+esbuild.build({
+ banner: {
+ js: banner,
+ },
+ entryPoints: ['main.ts'],
+ bundle: true,
+ external: ['obsidian'],
+ format: 'cjs',
+ watch: !prod,
+ target: 'es2016',
+ logLevel: "info",
+ sourcemap: prod ? false : 'inline',
+ treeShaking: true,
+ outfile: 'main.js',
+}).catch(() => process.exit(1));