【问题标题】:Electron - Breakpoints only work in main.js, but not in index.jsElectron - 断点仅适用于 main.js,但不适用于 index.js
【发布时间】:2017-07-17 02:03:11
【问题描述】:

半小时以来,我一直在研究电子快速入门教程。就像文档告诉我的那样,我创建了这样的文件结构:

  • package.json
  • main.js
  • index.html

从文档出发,我对 launch.json 进行了更改,以使我的项目在 Visual Studio Code 中以 F5 开始:

       "type": "node",
        "request": "launch",
        "name": "Programm starten",
        "program": "${workspaceRoot}/main.js",
        "cwd": "${workspaceRoot}",
        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
        "runtimeArgs": [
            "--enable-logging"
        ]

我的 oncklick() 函数驻留在 index.js 中,在 index.html 中引用:

<script src="index.js"></script>

一切都很好,但是如何让我的 index.js 断点在 VSC 中工作? Main.js 断点应该停止。

谢谢 皮克斯

【问题讨论】:

    标签: javascript visual-studio-code electron


    【解决方案1】:

    你能像这样改变你的launch.json并检查这个文件吗 http://electron.rocks/debugging-electron-in-vs-code-revised/

       {
        "name": "Debug",
        "type": "chrome",
        "request": "launch",
        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
        "runtimeArgs": [
            "${workspaceRoot}",
            "--enable-logging",
            "--remote-debugging-port=9222"
         ],
         "sourceMaps": false
    }
    

    顺便说一句,如果不是拼写错误,您可以将 oncKlick 函数更改为 onclick()

    【讨论】:

      猜你喜欢
      • 2023-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-16
      • 2018-07-31
      • 1970-01-01
      • 2019-12-14
      • 1970-01-01
      相关资源
      最近更新 更多