microsoft / vscode-recipes

MIT License
5.87k stars 578 forks source link

Launch configuration #242

Closed lewixlabs closed 3 years ago

lewixlabs commented 5 years ago

Hi, about https://github.com/microsoft/vscode-recipes/tree/master/Electron

I cloned the official boilerplate electron+typescript project https://github.com/electron/electron-quick-start-typescript

Debug on vscode correctly works, but I had to change, in json file, a field in runtimeArgs parameter, from "." to "dist/main.js", otherwise I got this error image

Here my edited launch.json, can somebody tell me if is this the right fix? Thanks! Lewix

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Electron: Main",
            "protocol": "inspector",
            "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
            "runtimeArgs": [
                "--remote-debugging-port=9223",
                "dist/main.js"
            ],
            "windows": {
                "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
            }
        },
        {
            "name": "Electron: Renderer",
            "type": "chrome",
            "request": "attach",
            "port": 9223,
            "webRoot": "${workspaceFolder}",
            "timeout": 30000
        }
    ],
    "compounds": [
        {
            "name": "Electron: All",
            "configurations": [
                "Electron: Main",
                "Electron: Renderer"
            ]
        }
    ]
}
connor4312 commented 3 years ago

Both work, but bear in mind of . to work you must have the main set in the package.json in the referenced folder.

lewixlabs commented 3 years ago

I didn't remember I had this issue still open, just resolved years ago, but thanks anyway! 👍