kv-clearnup/scripts/build-electron.mjs
2026-02-02 08:33:46 +07:00

16 lines
542 B
JavaScript

import * as esbuild from 'esbuild';
console.log('Building Electron Main and Preload...');
await esbuild.build({
entryPoints: ['electron/main.ts', 'electron/preload.ts'],
bundle: true,
platform: 'node',
target: 'node18',
external: ['electron'], // Do not bundle electron dependency
outdir: 'dist-electron',
format: 'cjs',
outExtension: { '.js': '.cjs' }, // Output .cjs to avoid conflict with package.json "type": "module"
})
.then(() => console.log('Build complete.'))
.catch(() => process.exit(1));