-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nextjs debuggingdoes not work #227
Comments
One thing I found which is very odd - this setting:
Actually works with breakpoints hitting even on refresh. HOWEVER hooks are totally broken on this, I get the error:
and I KNOW I'm using the hooks correctly, and the same code works fine hooks and all with yarn dev so I'm at a loss what's going on here... edit: ok after hours of trying to work this out I found the above config worked with hooks + breakpoints if I added a console option:
So without "console": "integratedTerminal" I was getting the hooks being improperly used error. As far as I can tell that shouldn't have such an impact to the build, is this a bug? |
Hey there, I created a PR on Next.js docs to have Next.js debugging working in either Chrome DevTools or VSCode, appreciate any feedback you have when trying it out on the PR: https://github.com/zeit/next.js/pull/10807/files?short_path=bfcc096#diff-bfcc096377efef455dd348d059704209 I choosed to only attach to the debugger from VSCode instead of trying to completely launch next from VSCode because in many occasions your Next.js application might be loaded by docker/overmind/foreman/heroku local... Let me know what you think! |
Updated the Next.js recipe. |
I tried the config suggested and got the runtime error issue so I played around with the launch.json until I landed on:
{ "version": "0.2.0", "configurations": [ { "type": "chrome", "request": "launch", "name": "Next: Chrome", "url": "http://localhost:3000", "webRoot": "${workspaceFolder}" }, { "type": "node", "request": "launch", "name": "Next: Node", "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/next.cmd", "runtimeArgs": ["--inspect"], "port": 9229, "console": "integratedTerminal" } ], "compounds": [ { "name": "Next: Full", "configurations": ["Next: Node", "Next: Chrome"] } ] }
However when I try to run this I get a 'Cannot connect to runtime process' econnrefused 127.0.0.1:9229 - this is on a fresh run with no chrome running on the PC so not sure why this is happening.
Furthermore if I do a 'yarn dev' and connect via f5 breakpoints work fine until I refresh or change the code, the breakpoints still appear as red so clearly something is going wrong there.
The text was updated successfully, but these errors were encountered: