mirror of
https://github.com/puhhh/clear-unused-images-obsidian.git
synced 2026-07-22 06:51:54 +00:00
24 lines
515 B
JavaScript
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();
|
|
}
|