next.js: HMR of next.config.js is broken for all examples using server.js

note: This issue is specifically for HMR of next.config.js requiring a server restart.

Bug report

The next.js/examples using server.js do not HMR next.config.js

To Reproduce

  • Use one of the examples which includes a server.js
  • Modify next.config.js while server is running
  • HMR does not occur

Expected behavior

HMR of next.config.js

System information

  • OS: macOS, Windows, Linux
  • Version of Next.js: 8.0.1

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 16
  • Comments: 22 (7 by maintainers)

Most upvoted comments

+1

HMR has suddenly stopped working for existing and new projects across different next.js versions. Perhaps one of the dependencies released an update that is causing this issue for any new npm installation of next.js?

+1 for this.

We have a fairly simple custom server, not too different from the examples, and when making a code change the console will display “[HMR] bundle rebuilding”. The network shows requests for both the update check, and the patched component, and both look correct to me.

http://localhost:3000/_next/static/webpack/51255de6f7bd9c29505b.hot-update.json:

{"h":"9160ba30e149d0ed69d9","c":{"static/development/pages/index.js":true}}

http://localhost:3000/_next/static/webpack/static/development/pages/index.js.51255de6f7bd9c29505b.hot-update.js:

webpackHotUpdate("static/development/pages/index.js",{
/***/ "./src... 
[expected updated source] 

But it will just hang on “[HMR] bundle rebuilding” and never apply the changes.

Once again we’d be super happy to look into these issues! But they’re impossible to debug from our side if you don’t provide a reproduction.

@dreamthink this issue has nothing to do with HMR of pages, it’s aimed at changing next.config.js requiring a server restart. I’m not aware of a similar report, so you can create a new issue, we need a reproduction to be able to debug this issue though 🙏 Thank you!

FYI I’m not a robot, I just keep repeating myself for the third time 😅

in my case, removing all imported CSS files fix the issue. I have removed all import path/to/style.css and put all those files in head section of parent page:

<Head>
<link href="static/style.css" rel='stylesheet' />
</Head>