渲染進程調試(進入網頁版的f12調試模式):
ctrl shift i
View->toggle Developer tools
主進程調試:
vscode中左側豎直欄第四個運行小蟲子按鈕,在上方設置中查找launch.js
將其中內容替換成
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
},
"args" : ["."]
}
]
}
點擊左上角運行按鈕就可進行調試
主進程調試配置圖: