调试
190字小于1分钟
2024-12-28
electron vscode 调试配置示例
{
"version": "1.0.0",
"configurations": [
// 调试主进程
{
"name": "Main",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
},
// 设置渲染进程监听端口
"args": [
".",
"--remote-debugging-port=9222"
],
"outputCapture": "std",
"console": "integratedTerminal"
},
// 调试渲染进程
{
"name": "Renderer",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}",
// 调试超时时间
"timeout": 300000
}
],
"compounds": [
{
"name": "Electron: All",
"configurations": [
"Main",
"Renderer"
],
}
],
}
electron-forge 调试配置示例
{
"version": "1.0.0",
"configurations": [
// 主进程调试配置
{
"type": "node",
"request": "launch",
"name": "Main",
"runtimeExecutable": "${workspaceFolder}/node_modules/@electron-forge/cli/script/vscode.sh",
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/@electron-forge/cli/script/vscode.cmd"
},
// 设置渲染进程监听端口
"runtimeArgs": [".", "--remote-debugging-port=9222"],
"cwd": "${workspaceFolder}",
"outputCapture": "std",
"console": "integratedTerminal"
},
// 渲染进程调试配置
{
"name": "Renderer",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}",
// 调试超时时间
"timeout": 300000
}
],
"compounds": [
{
"name": "Electron: All",
"configurations": ["Main", "Renderer"]
}
]
}