electron-react-typescript-boilerplate icon indicating copy to clipboard operation
electron-react-typescript-boilerplate copied to clipboard

Debugging support with VS Code

Open crazyRaisy opened this issue 7 years ago • 1 comments

Hi,

thx for doing this great boilerplate project. It help´s a lot when starting development with react and electron! Great! The only thing I am missing is a good debugging support out of my IDE. Is it possible to debug the main/render thread with VS-Code even when using the devserver (npm run dev)? What I have to do to configure the debugger properly?

crazyRaisy avatar Feb 06 '18 11:02 crazyRaisy

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [  
        {
            "type": "node",
            "request": "launch",
            "name": "Electron: Main",
            "protocol": "inspector",
            "sourceMaps": true,
            "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
            "program": "${workspaceFolder}/server.js",
            "cwd": "${workspaceRoot}/app",            
            "runtimeArgs": [
                ".",
                "--enable-logging",
                "--remote-debugging-port=9223",
            ]
        },
          {
              "name": "Electron: Renderer",
              "type": "chrome",
              "request": "attach",
              "port": 9223,
              "webRoot": "${workspaceFolder}",
              "timeout": 30000,
              "sourceMaps": true,
          }
    ],
    "compounds": [
          {
              "name": "Electron: All",
              "configurations": [
                  "Electron: Main",
                  "Electron: Renderer"
              ]
          }
      ]
    }

Above is my vscode launch.json. But I have to launch the Main first and then the Renderer, sometimes launch All works too but sometimes not, seems a race conditions issue.

EbenZhang avatar Nov 29 '18 12:11 EbenZhang