Electron快速入门之debug

view->toggleDevelpper Tools 本地桌面调试

浏览器debug
"start": "electron --inspect=5858 ."
浏览器上输入:edge://inspect/#devices
进行连接,不太好用

第三种本地ide调试
运行打开配置;launch.json

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Debug Main Process", // 配置方案名字, VSCode左下角可以切换配置方案
        "type": "node",
        "request": "launch",
       "cwd":"${workspaceRoot}",
       "runtimeExecutable":"${workspaceRoot}/node_modules/.bin/electron",
       "windows":{
           "runtimeExecutable":"${workspaceRoot}/node_modules/.bin/electron.cmd"
       },
       "args":["."],
        "outputCapture": "std",
      },
    ]
  }

  设置断点,启动就能调试了

原文地址:https://www.cnblogs.com/q1359720840/p/14375722.html