-
使用Visual Studio Code打开Electron工程的主目录,比如hello-world:
-
左侧菜单栏选择【Run and Debug】:
-
创建launch.json配置文件
-
选择调试器为Node.js
-
创建后的launch.json内容如下所示:
需要修改配置中的type等内容,修改后完整launch.json配置如下:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "调试Electron",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\index.js"
}
]
}
- 配置完成后,即可进行调试