原文地址:https://electronjs.org/docs/tutorial/debugging-main-process-vscode,有问题最好查看官网文档
1.在代码根目录,添加 .vscode/lanuch.json,内容如下:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"args" : ["."],
"outputCapture": "std"
}
]
}
2、打断点,在vscode 按快捷键F5或点击开始调试按钮