fix(electron): explicitly disable sandbox for preload script compatibility

The preload script uses require() for local modules which is not
supported in Electron's sandboxed preload environment (default since
Electron 20). This only affects Electron's preload API restrictions,
not Chromium's OS-level process sandbox which remains active.
This commit is contained in:
Johannes Millan 2026-03-22 19:07:47 +01:00
parent 4b6bb88523
commit 815341d5e8

View file

@ -124,6 +124,10 @@ export const createWindow = async ({
webSecurity: false,
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: false,
// Required: preload.js uses require() for local modules (e.g. ./shared-with-frontend/ipc-events.const).
// Electron 20+ defaults sandbox to true, and sandboxed preloads can only require built-in Electron
// modules. This does NOT disable Chromium's OS-level process sandbox (that's --no-sandbox).
sandbox: false,
// make remote module work with those two settings
contextIsolation: true,
// Additional settings for better Linux/Wayland compatibility