Enabling integration with Node in Electron.js
Node's integration with Electron refers to the ability to access Node.js resources from within the rendering process; with this, we can make use of the Electron API from the website in an easy and direct way.
Earlier we saw a feature of Electron which is the Debug (devTools) of the application in Chrome Electron.js
The integration with Node is disabled by default in Electron and for final or production applications it is recommended to disable it as a security measure.
Being able to use Node from the web page (and with this, being able to import and use any package), is essential to carry out various operations that, in summary, such as communication between processes that we will see in the next section; To enable the integration with Node, we put:
index.js
let win = new BrowserWindow({
width: 800,
height:600,
webPreferences:{
nodeIntegration: true,
contextIsolation: false
}
})The next step is to learn how to create cross-platform menus in Electron.js
I agree to receive announcements of interest about this Blog.
Node integration with Electron refers to the ability to access Node.js resources from within the rendering process.