调试主进程配置文件

断点调试的配置文件

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "调试主进程",
            "cwd": "${workspaceRoot}",
            "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
            "windows": {
                "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
            },
            "args": [
                "."
            ],
            "outputCapture": "std",
        }
    ]
}

调试渲染进程

直接用开发者工具调试即可
如果要在应用打开的时候自动打开开发者工具,这时候可以再主进程里面的win对象上加上这一句

win.webContents.openDevTools()
Last modification:May 23, 2020
If you think my article is useful to you, please feel free to appreciate