Search code examples
ruby-on-railslivereloadwebpacker

webpack server live reload


I'm building a react-rails app with rails 5.2.

react-rails-hot-loader is not compatible with rails 5.2, the live reloding would work with react_on_rails and I am trying to understand how to configure webpacker to live-reload

I had a read at the following issue

I run ./bin/webpack-dev-server --inline=false and my rails s in a separate terminal instance, but I can not display the site on webpacker localhost:3035/movies. The output in the browser is Cannot GET /movies

I just created the repository, do not know webpacker and would really appreciate any input.


Solution

  • webpacker 3.3.5 supports hot reloading

    running ./bin/webpack-dev-server and rails s in a different terminal allows you to use hot reloading features

    My understanding is that webpacker development server will provide the js, css and image assets to the rails server.

    The application is available at localhost:3000 (from the rails server) for development with hot reloading. I started the webpacker dev server before my rails s

    Some more article explains more in details how to configure the webpacker server

    https://medium.com/statuscode/introducing-webpacker-7136d66cddfb https://medium.com/rubyinside/hot-module-reloading-with-webpacker-b663643a60b1https://github.com/justisb/react_on_rails/blob/master/docs/additional-reading/hot-reloading-rails-development.md https://learnetto.com/tutorials/hot-module-replacement