Electron调试主进程

2020-03-03  本文已影响0人  我就是看看哦

1、electron --inspect=5858

"scripts": {
    "start": "electron --inspect=5858 ."
  },

在浏览器输入:chrome://inspect/#devices

image.png

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 加上断点

上一篇 下一篇

猜你喜欢

热点阅读