fix: bundle the Electron preload so the sandboxed bridge loads in packaged builds (v2.0.1)

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
This commit is contained in:
Claude committed 2026-09-03 15:38:36 +00:00
1 parent e3d5ead652
commit c73114eb0d
7 files changed
+524 -10

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
// 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'
});