Debugging
Last updated
Was this helpful?
Last updated
Was this helpful?
In Electron apps, the main and renderer processes have different debugging mechanisms:
Renderer processes can be debugged using Chromium DevTools.
The main process can be debugged via the --inspect
and --inspect-brk
command line flags.
This guide goes over Forge-specific ways of debugging the main process through the command line or with a code editor.
For more general information on debugging Electron apps, see the .
You can specify the --inspect-electron
flag when running electron-forge start
. Internally, this will activate the , and the main process will listen for a debugging client on port 5858.
Once your app is active, open in any Chromium-based browser to attach a debugger to the main process of your app.
To debug the main process through VS Code, add the following :
Once this configuration is added, launch the app via VS Code's Run and Debug view to start debugging.
Access the Run > Debug...
menu and select the Edit Configurations...
option to open the Run/Debug Configurations
window.
Click on the Add new configuration
button (the +
icon) in the upper-left corner and select the npm
template.
In the Scripts
dropdown menu, select start
.
Click on Debug
to start debugging your app.