mirror of
https://github.com/R0m1k3/EveFlow.git
synced 2026-10-11 17:29:03 +02:00
The preload script imported ../shared/ipc at runtime; sandboxed preloads cannot require local modules, so window.eveflow was never exposed in the installed app and every request fell back to browser fetch (Failed to fetch, LOCALHOST metrics). Main and preload are now bundled with esbuild into single files in dist-electron/. Also: explicit error banner when the bridge is missing inside Electron, and a more precise connection test message (transport path, capabilities status). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Wn5VX9HNbJ7N54hR24u9Y
20 lines
586 B
JavaScript
20 lines
586 B
JavaScript
// Bundles the Electron main and preload scripts into single CommonJS files.
|
|
// The preload runs in a sandboxed renderer where `require()` of local modules is forbidden,
|
|
// so everything it imports must be inlined.
|
|
import { build } from 'esbuild';
|
|
import { rmSync } from 'node:fs';
|
|
|
|
rmSync('dist-electron', { recursive: true, force: true });
|
|
|
|
await build({
|
|
entryPoints: ['electron/main.ts', 'electron/preload.ts'],
|
|
outdir: 'dist-electron',
|
|
bundle: true,
|
|
platform: 'node',
|
|
format: 'cjs',
|
|
target: 'node22',
|
|
external: ['electron'],
|
|
sourcemap: false,
|
|
logLevel: 'info'
|
|
});
|