New Sep 9, 2025

How to debug only one file in Next.js 15 (Chrome DevTools & VS Code) without stepping into node_modules or other components?

Libraries, Frameworks, etc. All from Newest questions tagged reactjs - Stack Overflow View How to debug only one file in Next.js 15 (Chrome DevTools & VS Code) without stepping into node_modules or other components? on stackoverflow.com

1.Chrome DevTools problem

2.VS Code problem

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Next.js: debug server-side",
      "type": "node-terminal",
      "request": "launch",
      "command": "npm run dev",
      "skipFiles": [
        "<node_internals>/**",
        "${workspaceFolder}/node_modules/**"
      ]
    },
    {
      "name": "Next.js: debug client-side",
      "type": "chrome",
      "request": "launch",
      "url": "http://localhost:3000"
    },
    {
      "name": "Next.js: debug client-side (Firefox)",
      "type": "firefox",
      "request": "launch",
      "url": "http://localhost:3000",
      "reAttach": true,
      "pathMappings": [
        {
          "url": "webpack://_N_E",
          "path": "${workspaceFolder}"
        }
      ]
    },
    {
      "name": "Next.js: debug full stack",
      "type": "node",
      "request": "launch",
      "program": "${workspaceFolder}/node_modules/next/dist/bin/next",
      "runtimeArgs": ["--inspect"],
      "skipFiles": [
        "<node_internals>/**"
      ],
      "serverReadyAction": {
        "action": "debugWithEdge",
        "killOnServerStop": true,
        "pattern": "- Local:.+(https?://.+)",
        "uriFormat": "%s",
        "webRoot": "${workspaceFolder}"
      }
    }
  ]
}

What I tried:

In Chrome DevTools I added /node_modules/ to the ignore list. I also tried ignoring parts of my own src/ folder.

In VS Code I copied the launch.json config from the Next.js documentation and added "skipFiles": ["<node_internals>/", "${workspaceFolder}/node_modules/"].

I also tried adding breakpoints only in the file I want to debug.

What I expected:

When stepping through code inside my component (e.g. in a useEffect), I expected the debugger to stay only in that file.

In VS Code I expected skipFiles to fully ignore everything from node_modules.

What actually happened:

In Chrome DevTools it still steps into other React components in my project whenever they re-render, even though I just want to debug one file.

In VS Code it still sometimes steps into code inside node_modules, even though I added it to skipFiles.

Scroll to top