mirror of
https://github.com/echore/vault-autopilot.git
synced 2026-07-22 08:34:00 +00:00
21 lines
515 B
JavaScript
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(); }
|