question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should handle when app server is reloaded via nodemon

See original GitHub issue

I have it so that my app server (which, of course, contains webpack-dev-middleware and webpack-hot-middleware) is restarted when any server-side files are changed. Unfortunately, what’s happening is that as soon as the server is restarted, something is triggered such that now I see the following message in the browser console:

GET http://localhost:3000/__webpack_hmr net::ERR_INCOMPLETE_CHUNKED_ENCODING

I don’t know enough to know why this is happening exactly, but I do know that I’d like the page to reload when this happens. Any idea on how to do this?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:17
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
glenjamincommented, Sep 19, 2015

You should at least configure nodemon to ignore the client folder, so that it only restarts on server changes.

The client-side event-stream should reconnect after the server has restarted.

Feel free to reopen if you have more questions or suggestions.

7reactions
glenjamincommented, Apr 7, 2016

But I can’t understand how the “Server-side express routes hot reloading” works, it seems not the nodemon’s effect?

Correct, the key point is here: https://github.com/glenjamin/ultimate-hot-reloading-example/blob/master/server.js#L28 Every request does a require(), which will use the require.cache if primed, or trigger a fresh require.

Whenever the /server/ files change, we clear the module cache: https://github.com/glenjamin/ultimate-hot-reloading-example/blob/master/server.js#L37

Read more comments on GitHub >

github_iconTop Results From Across the Web

Don't use nodemon, there are better ways! | by Kevin Simper
Okay, we know the solution is to not restart simply because then the server can not be down, but we still want to...
Read more >
Using nodemon for auto-reload of server after code change for ...
Was a newbie to node.js, whenever I make a change in the code, In the terminal, I used to keep on hitting Ctrl+C...
Read more >
How to Configure Nodemon to Auto-reload Node App?
We'll create a basic node app and if any change occurs in the app then nodemon will automatically restart the server for us....
Read more >
Chapter V - Reload server upon changes (the smart way)
The most common way to handle server reloads is using nodemon. This tool wraps your script in a separate process, watches your files...
Read more >
Refresh front and backend changes to browser with Express ...
Changed frontend files can be re-served without restarting Express. To freshen backend files, we'll restart the server using Nodemon and signal the browser...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found