From 02ac033b15fd158638ecc650cdbd0cea6b94d77a Mon Sep 17 00:00:00 2001 From: Phillip Date: Mon, 25 Oct 2021 17:45:15 +0200 Subject: Use ESBuild API instead of passing command line arguments (#16) --- esbuild.config.mjs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 esbuild.config.mjs (limited to 'esbuild.config.mjs') 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)); -- cgit v1.2.3