Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(desktop): bridge MAIN_VITE_API_URL to process.env for packaged builds

yushenb7477cb64636
diff --git a/apps/desktop/src/main/electron-env.d.ts b/apps/desktop/src/main/electron-env.d.ts
index 58860c2bce..da3774b4c1 100644
--- a/apps/desktop/src/main/electron-env.d.ts
+++ b/apps/desktop/src/main/electron-env.d.ts
@@ -5,6 +5,7 @@
interface ImportMetaEnv {
readonly MAIN_VITE_GATEWAY_URL: string
readonly MAIN_VITE_WEB_URL: string
+ readonly MAIN_VITE_API_URL?: string
}
interface ImportMeta {
diff --git a/apps/desktop/src/main/index.ts b/apps/desktop/src/main/index.ts
index f0780a5f9d..07e362a102 100644
--- a/apps/desktop/src/main/index.ts
+++ b/apps/desktop/src/main/index.ts
@@ -44,6 +44,13 @@ process.stderr?.on?.('error', (err: NodeJS.ErrnoException) => {
throw err
})
+// Bridge Vite build-time env to process.env for externalized @multica/core
+// In dev mode, electron-vite already loads .env into process.env;
+// In packaged builds, only import.meta.env has the value (injected at build time).
+if (import.meta.env.MAIN_VITE_API_URL) {
+ process.env.MULTICA_API_URL ??= import.meta.env.MAIN_VITE_API_URL
+}
+
import { app, BrowserWindow, shell, ipcMain } from 'electron'
import { fileURLToPath } from 'node:url'
import path from 'node:path'