Next.js: Integration between server and client hot-reloading

Created on 6 Feb 2017  路  4Comments  路  Source: vercel/next.js

Projects with custom server (like my own: https://github.com/relatenow/relate), where nodemon is used to hot-reload server changes, don't fare well when changing code on both the server and the client, especially simultaneously. In that case, hot-reloading might get stuck and never recover:

DONE  Compiled successfully in 3764ms

[nodemon] restarting due to changes...
WAIT  Compiling...

DONE  Compiled successfully in 2160ms

The above message might lead to think that reloading is complete, but actually there's no confirmation message from nodemon, only from Next. Nodemon is stuck for some reason.

Also the messages are different when the server or the client reloads ([nodemon] restarting due to changes... in the former case, and WAIT Compiling... in the latter).

I don't see an obvious way to fix this, but thought would report it to draw attention to the fact that it's quite cumbersome nevertheless (need to restart server manually in these cases).

Most helpful comment

I am using babel-watch instead of nodemon for hot-reloading with a custom server

This is what i run

"watch": "node_modules/.bin/babel-watch -w database -w routes -w server.js -w util.js --disable-autowatch server.js"

So far its working pretty well, just make sure to add the folders you want to be watching that next isn't watching

All 4 comments

I am using babel-watch instead of nodemon for hot-reloading with a custom server

This is what i run

"watch": "node_modules/.bin/babel-watch -w database -w routes -w server.js -w util.js --disable-autowatch server.js"

So far its working pretty well, just make sure to add the folders you want to be watching that next isn't watching

Hey! Curious (and optimistic) about this being closed - is there a solution for this use case in the works?

@jesseditson closed because the issue has been inactive for more than 9 months, and we're having the #1388 issue there already 馃憤

Fair enough! Would love to see some progress over on #1388 but understand how much work it is to maintain this stuff. Happy to help where needed if the team has time for review over there!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wagerfield picture wagerfield  路  3Comments

YarivGilad picture YarivGilad  路  3Comments

lixiaoyan picture lixiaoyan  路  3Comments

olifante picture olifante  路  3Comments

timneutkens picture timneutkens  路  3Comments