Closed alex-klimov closed 3 years ago
Guys, is this repository maintained? Looks like all new issues are not reviewed.
I ran into this issue and I didn't like how it was necessary to do a page reload. I noticed our project had an old electron launch config which was strictly only the renderer process (not attach like the new one for Main + Renderer). When i used that launch one, for some reason the breakpoints early in the renderer process actually attached. Also even if necessary, launch at least allows you to provide breakOnLoad: true (but this wasn't necessary for our project).
So just as a test, I changed our new config which is based on the recipe you mentioned to have the Renderer be "request": "launch" instead of "request": "attach" and it launched a blank chrome page which ultimately didn't affect anything, but when Electron loaded and the Renderer process came up, it actually hit a breakpoint early on. So next I basically just made it use a "runtimeExecutable" which was an empty cmd file that did nothing to stop it from opening the unnecessary chrome window. It seems really hacky to do it like that, yet it seems to work. Not sure why "attach" behaves differently from "launch" in such a way.
This is more and issue on Electron or Chrome itself than it is on js-debug -- there is no mechanism for this.
Hello,
Very good work was put in place to make Chrome debugger in VS Code to pause on load and wait for the debugger: https://github.com/Microsoft/vscode-chrome-debug/issues/445
Was it ever ported to work with Electron Renderer process? Current instructions advise to reload the page: https://github.com/microsoft/vscode-recipes/tree/master/Electron
Now go to your Electron app window and reload the page (View -> Reload or Cmd/Ctrl+R) to make sure the breakpoints are set.
The reason why it is important: debugging tests running in Electron process. Loading Electron rendering tests in the native execution environment allows for much better testing validation without mocking. Right now a lot of people suffer without good debugging support: https://github.com/facebook-atom/jest-electron-runner/issues/30
I was able to setup debug for Electron Main process by making it break on load and wait for debugger to join. I don't see how it would be possible to do the same for Electron Renderer process.
Cheers!