fdaciuk / workflow-reactjs

My workflow with ReactJS + Webpack 3+
146 stars 51 forks source link

Newbie questions #4

Closed geraldchecka closed 7 years ago

geraldchecka commented 7 years ago

Hi Fernando, I use this as a ref for setting up my config. Good one. Thanks. I have two questions. 1) There's an additional line if (module.hot) {}. How do you deal with this unnecessary code in production build? You remove it prod build manually? 2) There's another additional line import { AppContainer } from 'react-hot-loader', which is a standard of wrapping components if using RHL 3. Does it mean that the same lines go into production as well with 'react-hot-loader' as a dependency?

Kindly reply.

fdaciuk commented 7 years ago

Hey @geraldchecka!

module.hot is not available when NODE_ENV is "production", so, this code goes to production, but does nothing =)

The same for AppContainer: although it is a development module, in production it just returns its chidren, and doesn't affect the final bundle.

This repository it is in constantly evolving, so it may be changed in the future =)