title: How to debug a Node.js server? The debugger skips my breakpoints! (Using VSCode)
body: <p>I'm trying to debug a Next.js app with a custom server which I normally run with a <code>dev</code> Yarn script that executes <code>node server.js</code>.</p>
  
  <p>VSCode includes a Node.js debugging extension and <a href="https://code.visualstudio.com/Docs/editor/debugging" rel="nofollow noreferrer">this guide</a>, which I've followed. I created a new Yarn script called <code>dev:debug</code> that runs <code>node --inspect server.js</code>, and the following configuration in launch.json:</p>
  
  <pre><code>{
    "type": "node",
    "request": "launch",
    "name": "Debug via Yarn",
    "runtimeExecutable": "yarn",
    "runtimeArgs": ["dev:debug"],
    "port": 9229
  }
  </code></pre>
  
  <p>However some breakpoints in modules imported by server.js are skipped and I'm not sure why. Other breakpoints in Next components do work when I load pages in my web app. Any ideas?</p>