主进程调试方法
方法1:浏览器调试方式
package.json修改:
{ "name": "electron-quick-start", "version": "1.0.0", "description": "A minimal Electron application", "main": "main.js", "scripts": { "start": "electron --inspect=5858 ." }, "repository": "https://github.com/electron/electron-quick-start", "keywords": [ "Electron",
方式2:vscode调试:
修改launch.json配置文件:
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron Main",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"program": "${workspaceFolder}/main.js",
"protocol": "inspector" //添加默认的协议是legacy,这个协议导致不进入断点
},
]
}