Create esbuild.config.mjs

This commit is contained in:
Phillip 2021-10-24 19:40:55 +02:00 committed by GitHub
parent d2bbd43c9d
commit d8cb7a43e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 0 deletions

28
esbuild.config.mjs Normal file
View File

@ -0,0 +1,28 @@
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',
minify: prod,
watch: !prod,
target: 'es2016',
logLevel: "info",
sourcemap: prod ? false : 'inline',
treeShaking: true,
outfile: 'main.js',
}).catch(() => process.exit(1));