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

Debug Main not working with Visual Studio Code on Windows

Open gpisano97 opened this issue 8 months ago • 3 comments

Prerequisites

  • [X] Using npm
  • [X] Using an up-to-date main branch
  • [X] Using latest version of devtools. Check the docs for how to update
  • [X] Tried solutions mentioned in #400
  • [X] For issue in production release, add devtools output of DEBUG_PROD=true npm run build && npm start

Expected Behavior

Setting breakpoints on main process code and break the execution in those breakpoints.

Current Behavior

The execution doesn't stop in the breakpoints. The breakpoints are disabled during execution (transparent circle, must be red).

Steps to Reproduce

  1. Click on Run and Debug
  2. Select Electron: Main or Electron: All
  3. Press the "run debug" button.
  4. Set a breakpoint.
  5. Run the code portion where the breakpoint is setted.

Maybe the launch.json is not properly configured, but i don't know how to fix it.

Context

I'm writing a small utility desktop application in order to help the error checking of a new born product. The boilerplate has no changes, i only write: app.commandLine.appendSwitch("remote-debugging-port", '9223') in main.js to fix the render debug (that is not working too without this fix).

Your Environment

  • Node version : 23.11.0
  • electron-react-boilerplate version or branch : main branch, downloaded today 2024-04-04
  • Operating System and version : Windows 11

gpisano97 avatar Apr 04 '25 10:04 gpisano97

Having the same problem with debugging of the Main process. Electron webpage documents a different approach that omits webpack and is not suitable here. I am currently looking into that. Meanwhile some solutions for render process debugging are documented in #3472

JackGlobetrotter avatar Apr 28 '25 11:04 JackGlobetrotter

my solution is move electronmon . from "start:main" to a new npm script, and run new script with debug

yueisme avatar May 15 '25 15:05 yueisme

Can you share the exact scripts modifications needed? I'm kind of a noob on this.

Thanks!

mgscreativa avatar Sep 08 '25 18:09 mgscreativa