1、electron --inspect=5858
"scripts": {
"start": "electron --inspect=5858 ."
},
在浏览器输入:chrome://inspect/#devices
2、添加一个 .vscode/launch.json
文件并使用以下配置:
{
"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" : ["."]
}
]
}
image.png
在main.js 加上断点
网友评论