I've upgraded to Electron 14, refactored my project to accomodate for the "Removed: remote module" breaking change, but I'm unable to compile it due to the following TypeScript error:
Type '{ plugins: true; nodeIntegration: true; contextIsolation: false; enableRemoteModule: true; backgroundThrottling: false; webSecurity: false; }' is not assignable to type 'WebPreferences'.
Object literal may only specify known properties, and 'enableRemoteModule' does not exist in type 'WebPreferences'.ts(2322)
electron.d.ts(12612, 5): The expected type comes from property 'webPreferences' which is declared here on type 'BrowserWindowConstructorOptions'
The affected code:
const window = new electron.BrowserWindow({
// ...
webPreferences: {
plugins: true,
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
backgroundThrottling: false,
webSecurity: false
},
// ...
});
Is this a bug or an intentional change in Electron v14? What's a workaround?
enableRemoteModule
is no longer available (can still use@electron/remote
, but it is deprecated). See github.com/electron/remote/releases/tag/v2.0.0 – Stridor