gaearon / react-hot-loader

Tweak React components in real time. (Deprecated: use Fast Refresh instead.)
http://gaearon.github.io/react-hot-loader/
MIT License
12.26k stars 801 forks source link

How about not having hot in production at all? #1204

Open wmertens opened 5 years ago

wmertens commented 5 years ago

I'm wondering if there is anything wrong with doing this:

let App = <span>Hi</span>

if (module.hot) {
    App = require('react-hot-loader/root').hot(App)
}

export default App

I think this does the same as what is proposed in the readme, and it is marginally more efficient after dead code removal.

theKashey commented 5 years ago

Babel plugin is removing hot in production, but not hot from /root. @smelukov 🙏, could you save the day?