-
Notifications
You must be signed in to change notification settings - Fork 97
Avoid react-transform-hmr when compiling server side code. #83
Comments
Absolutely right. Would you like to propose a PR?
Is this causing problems? |
Ok, I'll propose a PR. |
Hot reloading in general now is in the middle of transition to something See On Wed, 16 Mar 2016 at 11:39 AM, gacosta89 notifications@github.com wrote:
|
I'm not willing to trade pure components for HMR. Pure components are simpler & faster. HMR is nice to have -- and with the live dev console running unit tests, meh. See Browsersync for an alternative to HMR. Admittedly much less cool, but good enough for the time being... the promise of HMR has not fully materialized in any of my real projects, yet. It works until it doesn't, and then it's just extra complexity for nothing. |
Yep, it is all about priorities. Since hmr is not working with stateless
|
Yes. If you want to contribute a PR, that would be wonderful. =) |
Back from holidays, ready to rock again \m/. Sorry for the delay |
🔥 🎸 🎶 |
If only I found this topic before... Spent literally hours on trying to figure out why my components don't get HMRed, was sure it was my fault somewhere; only to find out from this thread that pure components are not supported. Indeed there is an open discussion about that at gaearon/babel-plugin-react-transform#57 |
Yep. Adding a wrapper for client side app helps, though it does not work with non-pure components in a way that their own state is lost. Pretty much everything is explained in details by Dan (see link above). I am not sure really what is better, having it working partially or not having at all. Leaning towards adding pure hmr and waiting until React has support for hmr natively to keep component's state. |
I think you should avoid the react-transform-hmr step, when compiling server side code as this gaearon comment suggests. Particularly when you run the functional tests and e2e tests.
One simple solution might be using BABEL_ENV=production or something similar to disable the babel transform step. Another one is described further in the issue #5 where they suggest to put the .babelrc config inline in the webpack.config file.
Also I noticed that when running the dev console (npm start), of course hmr should be enabled but the devServer is doing server side rendering as well. This is an inconsistency. Is server side rendering necessary for development?
The text was updated successfully, but these errors were encountered: