mipearson / webpack-rails

Integrate webpack with your Ruby on Rails application
MIT License
543 stars 82 forks source link

Cannot get hot reload running #52

Open heygambo opened 8 years ago

heygambo commented 8 years ago

Hey,

I've combined your generated webpack config with the one that vue.js generates. Now I wonder how to get live reload running.

Webpack seems to inject some code that tries to load http://localhost:3808/__webpack_hmr But that path resolves in Cannot GET /__webpack_hmr.

Is that even needed?

When I include http://localhost:3808/webpack-dev-server.js then the whole page reloads reloads completely. That's not my intent.

Thx in advance!

Best, Christian

neurodynamic commented 8 years ago

+1

mipearson commented 8 years ago

I don't know, sorry :(

We haven't used hot reload in our own dev for a while as we found it unreliable. I might take it out of the example webpack config.

Keen for a solution, though, so leaving this open.

sankalpk commented 8 years ago

I recently got it working with a setup like this. It's been working well so far: https://gist.github.com/sankalpk/bbe7bf8a17a5638948e0d2b158f755fb

For those interested, here's a more full example with React and Relay: https://gist.github.com/sankalpk/e0664f9ec2c222e2c8a1d708ee159e14

sankalpk commented 8 years ago

If you like this approach, I'd be happy to submit a PR. Please let me know.

jarongao commented 7 years ago

I had trouble getting it working in my Docker setup and started looking into @sankalpk's solution.

I then realized I was on an older version of Node. I updated my Dockerfile to grab Node 7.2, and now hot reloading works for me with <script src="http://localhost:3808/webpack-dev-server.js"></script>.

For other Docker/Docker-compose users, I referenced the latest node image Dockerfile: https://github.com/nodejs/docker-node/blob/718102a587e7f02748402551b51407332384c1b3/7.2/Dockerfile

Update: This still reloads the whole page.