-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging configuration, update readme, add sample debugging configurations. #505
Conversation
Signed-off-by: Paul Mourer <paul.mourer@gmail.com>
Signed-off-by: Paul Mourer <paul.mourer@gmail.com>
Signed-off-by: Paul Mourer <paul.mourer@gmail.com>
Signed-off-by: Paul Mourer <paul.mourer@gmail.com>
Signed-off-by: Paul Mourer <paul.mourer@gmail.com>
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron-webpack", | ||
"args": ["dev"], | ||
"env": { | ||
//"DEBUG":"*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this line commented as it may be useful. This outputs extremely verbose output from electron/electron-webpack.
"sourceMaps": true, | ||
"smartStep": true, | ||
"showAsyncStacks": true, | ||
"timeout": 30000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This timeout will vary, but it needs to be longer than the amount of time it takes for the electron app to launch so that VSCode does not give up. Perhaps i will note this..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted.
Signed-off-by: Paul Mourer <paul.mourer@gmail.com>
@algernon - go ahead and merge at your leisure, then :) |
This PR adds sample debugging configurations under a
dev/sample
folder (would this be the proper/desired location?) and and ENV file that sets proper environment variables for the main process, and allows a remote debugging port to be passed to the renderer process.Few gotchas:
src/main/index.js
. Sometimes it will, other times it seems to attach after this code has been executed.--inspect-brk=$PORT
under ELECTRON_ARGS to break on the first line (and then ideally you could connect debugger before any code insrc/main/index.js
is executed)... but this seems to break on the first line of some internal electron process, rather than the app.A workaround for these could be to throw a
debugger;
line insrc/main/index.js
if you need to debug that file, and then hopefully execution would sit until the debugger connects, unsure on that one.3. The renderer process doesn't seem to map breakpoints within class components properly. (more reason to use functional components? 😄 ) Any breakpoint set within the component is mapped to the class declaration line, and then following execution leads to a rabbit hole of inner React modules. I am not sure how to get past this, and I couldn't find anything about this in searching.Re: # 3 -- This seems to be related to HMR, if a refresh is forced once the app has opened (Ctrl + r), then breakpoints are mapped properly. Unsure why.
In VSCode it is also possible to launch with debug params in an external console (supposedly) but when i tried this, it just launched my terminal and never acutally launched the app within that terminal window. I think this would be ideal for the main process, rather than launching within VSCode's internal terminal (which can be hard to use).
Reference
electron-webpack env vars
debugging issue 1
debugging issue 2