Electron Js - Cannot Destructure Property 'browserwindow' Of 'require(...).remote' As It Is Undefined
This is in Renderer Process: const {BrowserWindow} = require('electron').remote const path = require('path') const url = require('url') const newWindowButton = document.getEleme
Solution 1:
mainWindow=newBrowserWindow({width:1280,height:960,webPreferences: {
nodeIntegration:true,
enableRemoteModule:true,
},});
I believe you are using the new version of Electron. From v9 version, we are not allowed to use remote
on the renderer unless set the enableRemoteModule
as true.
Plus in order to load node_moduels
on renderer by using require()
, we need to also enable the nodeIntegration
as well. As require is one of node APIs.
https://github.com/electron/electron/issues/21408
Post a Comment for "Electron Js - Cannot Destructure Property 'browserwindow' Of 'require(...).remote' As It Is Undefined"