Next.js Discord

Discord Forum

How do I enable automatic reloading in Next.js to see changes without restarting the server?

Answered
Polar bear posted this in #help-forum
Open in Discord
Polar bearOP
Hello Next.js community,

I'm new to Next.js and web development in general, so please bear with me if my question seems basic. I've followed the installation guide and successfully created my first Next.js app. However, I'm encountering an issue with auto-reloading after making changes to page.js file located in src/app/page,js .

Problem: After modifying the file in my project using Visual Studio Code and saving it, I expect to see the changes reflected in my browser automatically. However, the changes only appear when I stop and restart the development server using npm run dev.

What I've tried:
I've ensured that I'm saving the file after making changes.
I've looked into the documentation and forums to understand if there's any additional configuration required for automatic reloading, but I couldn't find a solution.

My setup:
I opted not to include TypeScript and Tailwind CSS when creating the Next.js app using the command npx create-next-app@latest. That's all the changes I've made.
I'm using Visual Studio Code as my code editor.
I'm running the development server using npm run dev.


I would appreciate any guidance or explanations a beginner like me could understand. Thank you in advance for your help!
Answered by Polar bear
Oh. My. God. It worked...I'm crying tears of joy 😭 I SPENT HOURS on this. I was using WSL and vscode and most of my files I always had them stored on windows, never inside the ubuntu/linux. Changing it to be stored inside ubuntu/linux solved it. And the commands are running faster than ever! I'm so new to this so I had no idea how much of a big deal it is to use files from inside ubuntu. Thank you I really appreciate your help and fast response too!
View full answer

20 Replies

Thats odd. Usually after every save it should hot reload the changes.
It will show "Rendering page" in vscode and after that the changes will appear in the browser
Polar bearOP
@Polar bear Click to see attachment
try changing "HTML TEST" folder to something that doesnt have space
like html-test
Polar bearOP
@Polar bear Click to see attachment
then delete .next folder
and npm run dev again
Polar bearOP
I deleted the .next folder and ran the command again. Issue still persists.
without refreshing the page
Polar bearOP
considering it took that long to rerender that page, does waiting a bit mroe changes the result?
im not sure what causes this to be honest
i dont know either.
Polar bearOP
do u use wsl?
oh maybe thats why
@ᴉuɐpɹɐɐ oh maybe thats why
Polar bearOP
Oh. My. God. It worked...I'm crying tears of joy 😭 I SPENT HOURS on this. I was using WSL and vscode and most of my files I always had them stored on windows, never inside the ubuntu/linux. Changing it to be stored inside ubuntu/linux solved it. And the commands are running faster than ever! I'm so new to this so I had no idea how much of a big deal it is to use files from inside ubuntu. Thank you I really appreciate your help and fast response too!
Answer