1

I have a Rails application which uses Reactjs for client side and I am using webpacker to compile JS.

What are the advantages of running bin/webpack-dev-server alongside rails server? I know a few like Hot Module Reload and live reloading upon changes in JS.

Are there any upsides regarding the performance as well?

Rishabh
  • 223
  • 2
  • 6

1 Answers1

2

In development, it is pretty useful (mostly if you are touching the front part of the app)

This is because the whole js+css+html will not have to be recompiled fully at every change.

It can make page reloadings that could take quite some time take negligible time.

Other than that, it escapes my knowledge area :)


This is only based on practical experience; I do not know how it works under the hood.

But what I see happening on my logs when I don't use webpack-dev-server is that the front compiles every time I make a change.

When I do use it, though, this is not the case.

As such, the requests between changes take less time.

PCurell
  • 101
  • 3
  • Thank you. Can you please elaborate on how it fastens up page reloading or refer me to a good resource regarding this. – Rishabh Aug 27 '21 at 09:36
  • @Rishabh tbh I speak from observed experience. but what I see happening on my logs when I don't use `webpack-dev-server` is that the front compiles every time I make a change. When I do use it though, this is not the case. As such, the requests between changes take less time. – PCurell Aug 27 '21 at 09:43
  • 1
    The way that it speeds up page reloads is that it reloads automatically when the code changes and you don't have to manually navigate to the browser and refresh the page. In the time that it takes to CMD+Tab to the browser the page is usually loaded. – Jared Menard Mar 15 '22 at 12:59