feat(build): add esbuild bundler for Electron main process
This commit is contained in:
41
build-main.config.js
Normal file
41
build-main.config.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const esbuild = require('esbuild');
|
||||
const path = require('path');
|
||||
|
||||
async function build() {
|
||||
try {
|
||||
console.log('Building main process with esbuild...');
|
||||
|
||||
// Build main process
|
||||
await esbuild.build({
|
||||
entryPoints: ['src/apps/companion/main/index.ts'],
|
||||
bundle: true,
|
||||
platform: 'node',
|
||||
target: 'node20',
|
||||
format: 'cjs',
|
||||
outfile: 'dist/main/apps/companion/main/index.js',
|
||||
external: ['electron'],
|
||||
sourcemap: true,
|
||||
logLevel: 'info',
|
||||
});
|
||||
|
||||
// Build preload script
|
||||
await esbuild.build({
|
||||
entryPoints: ['src/apps/companion/main/preload.ts'],
|
||||
bundle: true,
|
||||
platform: 'node',
|
||||
target: 'node20',
|
||||
format: 'cjs',
|
||||
outfile: 'dist/main/apps/companion/main/preload.js',
|
||||
external: ['electron'],
|
||||
sourcemap: true,
|
||||
logLevel: 'info',
|
||||
});
|
||||
|
||||
console.log('✓ Main process and preload script built successfully');
|
||||
} catch (error) {
|
||||
console.error('✗ Build failed:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
build();
|
||||
Reference in New Issue
Block a user