echore_vault-autopilot/esbuild.config.mjs

21 lines
515 B
JavaScript

import esbuild from 'esbuild';
import process from 'process';
const prod = process.argv[2] === 'production';
const ctx = await esbuild.context({
entryPoints: ['src/main.ts'],
bundle: true,
platform: 'node',
external: ['obsidian', 'electron', 'node:*'],
format: 'cjs',
target: 'ES2018',
loader: { '.md': 'text' },
logLevel: 'info',
sourcemap: prod ? false : 'inline',
treeShaking: true,
outfile: 'main.js',
});
if (prod) { await ctx.rebuild(); process.exit(0); }
else { await ctx.watch(); }