In Electron there are two processes: (Main and Renderer) that takes care of the functioning of our desktop application. In order to debug our application, we have to individually debug the Main and Renderer processes.
Individual webpages running their renderer processes can be debugged by adding the following line in the main.js file.
Here the mainWindow is an instance of BrowserWindow class in Electron.
//Open developer tools
In order to debug the main process, there are two ways. One is to use command line switches such as electron --inspect=5858 appName and the other way is to use Visual Studio Code (VSCode)to debug the main process.