我有一个应用程序,它是一个带有脚本导入的HTML(Teacher.html)。
<script src="./scripts.js"></script>
我从示例代码中获得了一个调试配置:
{
"version": "0.1.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" : ["."]
},
]
}
在main.js中,我只是加载HTML。
mainWindow.loadFile('teacher.html')
我在文件中放置了几个断点,但是一旦调试开始,它们都变成了“未经验证的断点”。
如何使调试器停止在断点上?
发布于 2018-08-09 10:47:23
发布的代码只用于调试主进程,而不是Renderer进程(其中加载了HTML)。
应该工作的配置:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron: Main",
"protocol": "inspector",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"runtimeArgs": [
"--remote-debugging-port=9223",
"."
],
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
}
},
{
"name": "Electron: Renderer",
"type": "chrome",
"request": "attach",
"port": 9223,
"webRoot": "${workspaceFolder}",
"timeout": 30000
}
],
"compounds": [
{
"name": "Electron: All",
"configurations": [
"Electron: Main",
"Electron: Renderer"
]
}
]
}
https://stackoverflow.com/questions/-100002029
复制相似问题