Webpack in Developer Mode

Like the Rails asset pipeline, Webpack converts the files under its domain into JavaScript and CSS that the browser can handle. Unlike the Rails asset pipeline, it uses its own process to monitor the files for changes and to recompile them. As of Webpacker 3.0 that process, webpack-dev-server, runs inline with the Rails development server by default. However, you can separate them if you’d like. Running webpack-dev-server separately allows the compile to happen when the file changes rather than when you hit the page, which can feel faster. Also, when run standalone, webpack-dev-server can give you live reload while editing.

You can use a tool called Foreman to easily run that process alongside your Rails server.[34] ...

Get Rails 5 Test Prescriptions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.