Introduction
Step 1
Add the inspect option in package.json file . To allow server side debugging , we have to add this into our dev command , like this :-
Step 2
Inside your VsCode project create a file inside .vscode dir ( if you don't have then create one in root folder of your project ) with name launch.json . Now simply add this same configuration in it and save it :-
Step 3
After doing above steps we are ready to debug the app , stop your app terminal and go to the "debug and run" option in VsCode sidebar ( or use F5 key ) , select the "Next.js: debug full stack" option from dropdown and hit run . Now you can see the debugger getting attached to your terminal and done . You are ready to debug your app !
Conclusion
With this you can debug your both client and server side code . I am using NextJs v15.2.3 App router , it should work for Pages Router too . I created this because I couldn't found any helpful updated article or answer for myself . If you like this do share with other devs also . Happy Coding !
Comments
Post a Comment