Compiling Assets with Webpacker
Explore how to integrate Webpacker with Docker to compile Rails JavaScript assets efficiently. Understand configuring webpack-dev-server as its own container service and adjusting Docker Compose for seamless live reloading during development.
We'll cover the following...
We'll cover the following...
webpack-dev-server
As part of Webpacker, Rails provides the webpack-dev-server binary. This is a small server that runs in the background, automatically compiling our webpack-managed files.
If you were developing locally, this would just be another command you would issue from your terminal. However, the Docker way is to run this as a separate service in its own container.
Modification of Compose
Let’s add a new service for it to our docker-compose.yml file: