gaearon / react-hot-boilerplate

Minimal live-editing example for React
MIT License
3.91k stars 879 forks source link

hot reloading not functioning #43

Closed abd124abd closed 8 years ago

abd124abd commented 8 years ago

any ideas why it is failing to hot reload? Am required to refresh in order to update while working on your react-dnd chess tutorial, thanks :)

not sure if am doing something incorrectly but needed to add es6 and jsx regex to the loaders as well as a resolve key for the extensions for it to render properly.

*11.7.2015 - installed Node 4.x, still not working unfortunately. Re-installed webpack-dev-server globally after the new node install and it's now working.

ColeTownsend commented 8 years ago

Having the same problem @Cryptolemming

stevenbirr commented 8 years ago

Did not work for me at first. After installing Node 4 and the latest versions of node-gyp and npm hot module reloading works. Maybe my comment in this thread helps others: https://github.com/nodejs/node-gyp/issues/629#issuecomment-158742175

MaronMariusz commented 8 years ago

Hi, for me it does not work as well, even if I have installed Node 4. Can't reload content at all.

stevenbirr commented 8 years ago

.., Sorry, have to rectify... For me, it does still not work. Sometimes hot code reloading works, sometimes not. Very strange...

MaronMariusz commented 8 years ago

What I noticed this is all about some bad settings/packages/versions in node. At work I normally installed boilerplate and it was working like a charm. At home I have problems. I need to reinstall completely my env ^^

stevenbirr commented 8 years ago

Maybe this could help you: I had the same issue. At work it worked like a charm, at home sometimes yes, sometimes no. Thus, it had to be any timing issue. I played around with some WebpackDevServer options. Try this:

...
new WebpackDevServer(webpack(config), {
  watchOptions: {
    aggregateTimeout: 300,
    poll: 300
  },
})
...

Now, webpack hot reloading works for me. Tried it with node 4.2.2, npm 3.5.0, webpack 1.12.9, webpack-dev-server 1.14.0

thenewvu commented 8 years ago

I have experienced this issue. I tried @stevenpietzsch's solution and it seems working but no idea what I'm doing actually. Where the problem comes from is my concern now, any idea?

StefanHinck commented 8 years ago

Yep @stevenpietzsch your addition worked for me as well. So my server.js now looks like:

new WebpackDevServer(webpack(config), {
  publicPath: config.output.publicPath,
  hot: true,
  historyApiFallback: true,
  watchOptions: {
    aggregateTimeout: 300,
    poll: 300
  },...

I have no idea what this addition changes though, care to clarify a bit?

OXOYO commented 8 years ago

@stevenpietzsch Yeah! It works! Thansk! But there should not be a default configuration.

Prophet32j commented 8 years ago

hi guys. Not sure if you guys are still experiencing this problem. The solution that works for me was to remove "hot: true" from the server.js.

The reason for this is you are already using webpack.HotModuleReplacementPlugin along with the React Hot Loader module. Dan gives a specific note within his wiki to not call out --hot. --hot is the same as hot: true for Inline Dev Server.

See: http://gaearon.github.io/react-hot-loader/getstarted/ Also: https://webpack.github.io/docs/webpack-dev-server.html#inline-mode-with-node-js-api

alphanumeric0101 commented 8 years ago

This is all very confusing. I tried @Prophet32j's recommendation and that got my app refreshing completely upon each update. I then put back 'hot: true' and tried what @stevenpietzsch suggested and now it updates only the specific component when it detects a change, checking every .3 seconds I assume?

stevenbirr commented 8 years ago

I think, I found the solution for the problem. I found the clue here: https://webpack.github.io/docs/webpack-dev-server.html#working-with-editors-ides-supporting-safe-write You should have a look at your IDE, in my case PHPStorm, and disable the safe mode. After that, hot reloading works like a charm, even without

hot: true,
watchOptions: {
  aggregateTimeout: 300,
  poll: 300
}
alphanumeric0101 commented 8 years ago

thanks @stevenpietzsch, I'll look into this but I'm just using sublime and running from my terminal... will let you know if I find any kind of safe mode though.

gaearon commented 8 years ago

Closing as most of it is related to Webpack, and we can’t fix these issues here.

erchaves commented 5 years ago

Not sure this is relevant, but leaving a note just in case: I had a strange and subtle hot-reloading bug due to a caps case issue. When my file path used the incorrect casing, everything still worked except for hot-reloading on that module. The app was working, but hot-reloading failed silently.

I changed the incorrect import Home from '../components/Home'; to the correct import Home from '../Components/Home'; ('C' -> 'c') and hot reloading worked again. Sneaky.

It looks like caps-case issues have bitten others in similar situations: https://github.com/gaearon/react-hot-boilerplate/issues/8