Search⌘ K

Introduction to Webpacker

Explore the basics of Webpacker in Rails 6, including its setup and configuration for managing JavaScript and CSS assets. Understand how to use Webpacker with different frameworks, trigger compilations, and manage assets during development and deployment for efficient front-end workflows.

We'll cover the following...

As Rails 6 developers, our primary interaction with webpack is going to be through the Webpacker tool provided by Rails. In this chapter, I’ll talk about using Webpacker in development, and also how to customize it when you want additional features.

The Webpacker gem is a default part of a new Rails 6 installation, which means Webpacker goes in the Gemfile, and by default, the webpack:install task is run when the app is created. You can skip Webpacker entirely with rails new . --skip-webpack-install, or you can install one of the existing frameworks with something like rails new . ...