Next.js: Remove `react-hot-loader`

Created on 29 May 2018  路  9Comments  路  Source: vercel/next.js

It causes way more issues than it fixes.

It's a matter of removing it from babel options

    plugins: [dev && !isServer && hotLoaderItem, dev && reactJsxSourceItem].filter(Boolean)

becomes

    plugins: [dev && reactJsxSourceItem].filter(Boolean)
p1

Most helpful comment

I confirm, it works like a charm with @material-ui/styles. I have also the feeling that the end-to-end time for hot reloading has greatly improved 馃殌 .

All 9 comments

It鈥檚 a little more involved than just removing the babel plugin. Also requires to rewrite the provider component they have to handle errors with componentDidCatch. I鈥檓 planning to fix this after a bug fix when using _app.js

I wonder, which exactly issues does it cause?

@ArmorDarks Some changes made in RHL 4.1.0 cause this problem: https://github.com/zeit/next.js/issues/4232

What's alternatives? How we should auto-refresh page on changes?

Note that react-hot-loader !== hot reloading. Hot reloading still works. The only thing react-hot-loader did was keeping state, but there were too many cases in which it caused weird and unexpected behaviour. For example shouldComponentUpdate being overriden etc.

I confirm, it works like a charm with @material-ui/styles. I have also the feeling that the end-to-end time for hot reloading has greatly improved 馃殌 .

Good to hear @oliviertassinari 馃槍

This seems to have decreased hot reloading from a worst case of minutes to seconds for a handful of views, now it seems to perform as good as next.js v4, or even better. And some strange edge cases in development have disappeared. Great work.

Great 馃憤

Was this page helpful?
0 / 5 - 0 ratings