Unable to set breakpoints for nextjs app
See original GitHub issueI’m trying to debug my nextjs app with Firefox.
I managed to debug it with chrome.
The error is that firefox can’t find the files. I already tried to add pathMappings but that is a lot to do and it still does not find components that are used inside these mappings. Besides that: the chrome extension does not need these path mappings.
// launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Firefox",
"url": "http://localhost:3000/",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{"url": "/", "path": "${workspaceFolder}/pages/index.tsx"}
]
},
{
"type": "chrome",
"request": "launch",
"name": "Chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
{
"type": "node",
"request": "attach",
"name": "Server",
"port": 9229
}
],
"compounds": [
{
"name": "QLS: FullChrome",
"configurations": ["Server", "Chrome"]
},
{
"name": "QLS: FullFirefox",
"configurations": ["Server", "Firefox"]
}
]
}
With the specified pathMappings I can set breakpoints in index.tsx
My demo repo: https://github.com/Naxos84/nextjs-firefox-debug-demo
node version: 12.16.0 npm version: 6.13.4 vscode: 1.45.1 OS: windows 10
If you need any additional info please let me know.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Advanced Features: Debugging - Next.js
Debug your Next.js app. ... You can also press Ctrl + P on Windows/Linux or ⌘ + P on macOS to search for...
Read more >How/where to set breakpoints in NextJS app? - Stack Overflow
1 Answer 1 · In the Sources pane of devtools, press CTRL-P and write the name of the file you want to debug,...
Read more >nextjs - # - debugging - # - vscode - # - devtools
When fully setup, you'll be able to put breakpoints in both frontend (React) and backend code (Node.js, API routes). Then your favorite debugger...
Read more >Debugging Next.js Applications - elliott.dev
It's often more effective to use a step-through debugger to pause and inspect your code as it executes. This is especially true when:...
Read more >Running and debugging Node.js | WebStorm Documentation
js applications. You can put breakpoints right in your JavaScript or TypeScript code so you no longer need any debugger and console.log() ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hbenl The issue still exists. Please test it again with https://github.com/vercel/next-learn-starter/tree/master/demo
I’m migrating to Chrome right now. This extension is completely broken with Next.js. @Naxos84’s path mapping doesn’t work. The extension offers to add some mapping and they don’t work too
Please also try against any breakpoint that calls other than a page of component (for example a lib). In some cases, I’ve able to debug against some components but totally unstable
Yeah, this is my experience too. Chrome works fine, but the pathMapping on this just doesn’t work with a nextjs app