Creating a custom _error.js in pages directory makes HMR stop working.
This behavior occurs even when using Next's official example, unless your _error.js file contains a single div, with no other imports.
_error.js page, with the example provided in this repoindex.js contentThe window in the browser should update automatically.
When file saved:
Jesus I was so wrong.
Actually, eslint-loader dependency is what makes HMR stop working.
For some reason, eslint warnings are webpack warnings (see https://github.com/webpack-contrib/eslint-loader/issues/193). Although eslint-loader has the emitWarning: true param, it doesn't work as expected.
Just removed eslint-loader until this is resolved.
I'm not sure if this wrong behaviour has to do with next.js or webpack or eslint or eslint-loader community.
For the record, this also happens when any other webpack warning occurs (e.g. from mini-css-extract-plugin).
Any update or workaround on this issue?
For now, i'm running ESLint before application start only. Also, i'm using some linter plugins to my code editor. Haven't checked if there is any updates to fix this.
Solved in #6099
Most helpful comment
Solved in #6099