puhhh_clear-unused-images-o.../esbuild.config.mjs
2026-06-02 09:04:01 +03:00

24 lines
515 B
JavaScript

import esbuild from 'esbuild';
import process from 'node:process';
const production = process.argv[2] === 'production';
const context = await esbuild.context({
entryPoints: ['src/main.ts'],
bundle: true,
external: ['obsidian'],
format: 'cjs',
target: 'es2020',
sourcemap: production ? false : 'inline',
minify: production,
treeShaking: true,
outfile: 'main.js',
logLevel: 'info',
});
if (production) {
await context.rebuild();
await context.dispose();
} else {
await context.watch();
}