fix(desktop): bundle electron-updater into main.js

esbuild now bundles main.ts with electron-updater (and its transitive
deps) inline, externalizing only electron, workspace packages, and the
native better-sqlite3. This sidesteps the pnpm hoisting issue where
electron-updater's transitive `ms` lived only inside the .pnpm content
store and never landed in the packaged app.asar, leaving the in-app
updater non-functional.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-16 13:07:02 -07:00
parent 5a101dc70b
commit f84c048fe2

View File

@@ -5,7 +5,14 @@ import { buildDashboardClient, packageRoot, workspaceRoot } from "./workspace-to
const dashboardClientDir = join(workspaceRoot, "packages", "dashboard", "dist", "client");
const desktopDistDir = join(packageRoot, "dist");
const desktopClientDistDir = join(desktopDistDir, "client");
const externalMainProcessPackages = ["electron", "@fusion/core", "@fusion/dashboard"];
const sharedExternals = [
"electron",
"@fusion/core",
"@fusion/dashboard",
"better-sqlite3",
];
const mainExternals = sharedExternals;
const preloadExternals = sharedExternals;
async function ensureDashboardBuild(): Promise<void> {
console.log("[desktop:build] Building dashboard client...");
@@ -30,8 +37,7 @@ async function buildElectronEntrypoints(): Promise<void> {
platform: "node",
target: "node22",
sourcemap: true,
packages: "external",
external: externalMainProcessPackages,
external: mainExternals,
logLevel: "info",
}),
build({
@@ -43,7 +49,7 @@ async function buildElectronEntrypoints(): Promise<void> {
target: "node22",
sourcemap: true,
packages: "external",
external: externalMainProcessPackages,
external: preloadExternals,
logLevel: "info",
}),
]);