Electron main and renderer process debug configuration #493
Comments
The devtools should allow you to debug the renderer out of the box. Just drop a break point in the console. I've looked and tried several different ones, but only managed to get the main process going, so that's what I'd do. Also see Microsoft's debug notes: |
If people are still reading this, I found a way to debug the main process with sourcemaps. First, in the webpack.main.config.js file, add the last line in the "Adjust mainConfig for development settings" block :
Then, my launch.json config :
Now you should be able to debug using the |
@Seblor Thank you so much! :D |
@MaverickMartyn my breakpoints don't work either |
@NoelDavies Do you have a repo where this occours? |
Thanks a lot. My breakpoints also works fine. I think its because i am using webstorm. |
Mine doesn't work any more. idk why. |
I just worked on this repo, where it seemingly worked fine for the main process: https://github.com/MaverickMartyn/keep {
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
},
"args" : ["."],
"outputCapture": "std"
}
]
} However it is still a bit finicky. I have had issues with breakpoints not being hit, if they are set before starting debugging. |
I'm trying to set up VS Code debug configurations like this
{ //main
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"sourceMaps": true
},
{
"name": "Debug Renderer Process",
"type": "chrome",
"request": "attach",
"url": "http://localhost:9080",
"webRoot": "${workspaceRoot}/src"
}
and got messages like "Invalid responce {
"description": "node.js instance",
"devtoolsFrontendUrl": "chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5858/0f2c936f-b1cd-4ac9-aab3-f63b0f33d55e",
"faviconUrl": "https://nodejs.org/static/favicon.ico",
"id": "0f2c936f-b1cd-4ac9-aab3-f63b0f33d55e",
"title": "node",
"type": "node",
"url": "file://",
"webSocketDebuggerUrl": "ws://127.0.0.1:5858/0f2c936f-b1cd-4ac9-aab3-f63b0f33d55e"
}" for main and "connect ECONNREFUSED 127.0.0.1:9229" for render processes.
What am I doing wrong? Can somebody share debug configurations for VS Code or WebStorm?
The text was updated successfully, but these errors were encountered: