title: Debugging child process spawned by electron in VS code
body: <p>I am building an electron app in typescript with webpack, and I am running into the following vscode debugging problem:</p>
  
  <p><strong>Info:</strong> The main process spawns a child process by calling <code>fork('./dist/child', [], {execArgv: ['--debug-brk=3001']})</code>. My <code>launch.json</code> looks as follows:</p>
  
  <pre><code>{
      "name": "Debug child process",
      "type": "node",
      "request": "attach",
      "address": "localhost",
      "port": 3001
  }
  </code></pre>
  
  <p><strong>Steps:</strong> </p>
  
  <ol>
  <li>I launch my electron app in a terminal</li>
  <li>hit F5 to launch the vscode debugger</li>
  </ol>
  
  <p>As expected, it hits a break at the first line of my webpack build for the child process code (due to <code>debug-brk</code>). This allows me to register additional breakpoints with the debugger in my typescript source.</p>
  
  <ol start="3">
  <li>as expected, upon continuing, vscode hits those breakpoints nicely within my ts source. Good.</li>
  </ol>
  
  <p><strong>Problem:</strong> If I now restart the debugger (without any source changes or registering new breakpoints)...</p>
  
  <ol>
  <li><p>The initial breakpoint in the build is not hit</p></li>
  <li><p>My manually added breakpoints are marked ignored (<em>Breakpoint ignored because generated code not found (source map problem?).</em>)</p></li>
  <li><p>Any new breakpoint I add at this point is also marked ignored. </p></li>
  </ol>
  
  <p>I realize that debugging by Attach is different from debugging by Launch, and that the initial break enforced by a <code>debug-brk</code> fork is needed to give one the opportunity to register breakpoints for a node process that is attached to. </p>
  
  <p><strong>Question:</strong> However, what I would like to improve in my debugging experience is that a simple restart of the debugger is <em>not enough</em> to re-register some new (or old) breakpoints. I have to <em>entirely exit</em> my app and start it again, <em>before</em> the debugger upon restart will again halt at the first line of my build and recognize breakpoints I add at that stage. </p>
  
  <p>Is there a way anybody could recommend to improve this debug experience? I don't mind some extra steps as compared to a Launch debugging session, but having to manually quit and start my app just to debug it is a bit cumbersome, and makes actually debugging in the console almost more preferable... </p>
  
  <p>Thanks for any advise!</p>