How to debug Next JS apps

ref – https://www.youtube.com/watch?v=YzTWKenM5P0

In your root directory of your project, Click on the debug button in the navigation bar.

Click create a .vscode/launch.json file

Remove what’s currently in the file.

Go to Next JS’s docs, and copy the launch.js file contents from it.

https://nextjs.org/docs/pages/building-your-application/configuring/debugging

Now, in your root directory it should looks like this:

.vscode/launch.json

Make sure you click on the debug icon and then select “debug full stack”, which is the 3rd option you put in your launch.json

Running the Project

For CLIENT SIDE, Keep in mind that your package.json stays the same:

Client side debugging

Server Side

Make sure you click the debug icon on the side bar, then click the play button:

Specifically, like this:

You can use debugger keyword for a breakpoint.

Or you can put standard breakpoints.