From 12a513802a78848a1c1d9fc8e88b86ea79764110 Mon Sep 17 00:00:00 2001 From: 4gray Date: Sun, 23 Nov 2025 19:14:01 +0100 Subject: [PATCH] fix(electron): simplify production load and CI frontend build Remove unused url.format import and switch from loadURL with a formatted file: URL to loadFile for production. This simplifies code, avoids manual file URL construction, and makes the production path loading more robust. Also update CI job to build the frontend via the NX command (npx nx build web --skip-nx-cache) instead of npm run build:frontend, aligning the workflow with the monorepo's canonical build command. --- .github/workflows/build-and-make.yaml | 2 +- apps/electron-backend/src/app/app.ts | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-make.yaml b/.github/workflows/build-and-make.yaml index acda077b8..fff436794 100644 --- a/.github/workflows/build-and-make.yaml +++ b/.github/workflows/build-and-make.yaml @@ -41,7 +41,7 @@ jobs: run: pnpm install --no-frozen-lockfile - name: Build frontend - run: npm run build:frontend + run: npx nx build web --skip-nx-cache - name: Build backend run: npm run build:backend diff --git a/apps/electron-backend/src/app/app.ts b/apps/electron-backend/src/app/app.ts index 6bd03b797..e262c3ed2 100644 --- a/apps/electron-backend/src/app/app.ts +++ b/apps/electron-backend/src/app/app.ts @@ -1,6 +1,5 @@ import { BrowserWindow, screen, shell } from 'electron'; import { join } from 'path'; -import { format } from 'url'; import { environment } from '../environments/environment'; import { rendererAppName, rendererAppPort } from './constants'; import { store, WINDOW_BOUNDS } from './services/store.service'; @@ -118,17 +117,8 @@ export default class App { App.mainWindow.loadURL(`http://localhost:${rendererAppPort}`); App.mainWindow.webContents.openDevTools(); } else { - App.mainWindow.loadURL( - format({ - pathname: join( - __dirname, - '..', - rendererAppName, - 'index.html' - ), - protocol: 'file:', - slashes: true, - }) + App.mainWindow.loadFile( + join(__dirname, '..', rendererAppName, 'index.html') ); } }