1 Question: Electron - Breakpoints only work in main.js, but not in index.js

Question created on Sunday February 26, 2017

since half an hour I work on the electron-Quick-Start-Tutorial. Like the docs told me, I created the filestructure like this:

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

Departing from the docs I did changes on the launch.json to make my project start on F5 in Visual Studio Code:

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

My oncklick()-functions reside in index.js, that is referenced in index.html:

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

It's all fine, but how can I make my index.js-breakpoints work within VSC? Main.js-breakpoints stop as they should.

Thx piccus

3
1 answer                              3                         

can you change your launch.json like this and check this document 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
}

btw if its not a typo can you change your oncKlick function to onclick()

2
Sunday February 26, 2017
source posted here