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.
This commit is contained in:
4gray committed 2025-11-23 19:14:01 +01:00
1 parent e279172dfe
commit 12a513802a
2 files changed
+3 -13

No files matched your search

+1 -1
View File
@@ -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
+2 -12
View File
@@ -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')
);
}
}