I'm constantly having this issue with debugging Next.js API routes. Often I can't place breakpoints in vscode, or if I do it breaks at some totally random spot (sometimes it will open the correct transpiled file and then I can just move the breakpoint to where it should be).
The only chance I have is to stop my server, restart vscode, blow away the the .next directory, and restart. But as soon as I change some code, I have to do it all over again.
I feel like there must be some trick to it, otherwise, I feel like i'd see more complaints about it.
{"type":"node","request":"attach","name":"Attach to Program","skipFiles":["<node_internals>/**"],"port":9229},
"dev":"NODE_OPTIONS='--inspect' next dev",
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm constantly having this issue with debugging Next.js API routes. Often I can't place breakpoints in vscode, or if I do it breaks at some totally random spot (sometimes it will open the correct transpiled file and then I can just move the breakpoint to where it should be).
The only chance I have is to stop my server, restart vscode, blow away the the .next directory, and restart. But as soon as I change some code, I have to do it all over again.
I feel like there must be some trick to it, otherwise, I feel like i'd see more complaints about it.