Search⌘ K

Configuration and Code Files

Explore how to set up and configure Webpacker and webpack in Rails including environment-specific files, loaders, and key config files like tsconfig.json. Understand how application code files and packs are organized with examples of default packs and integration with Rails UJS, Turbolinks, and CSS preprocessing.

We'll cover the following...

Configuration files

The next category of files contains the configuration of webpack and Webpacker. There is a YAML file called config/webpacker.yml that has some general Webpacker options, including where to look for input files, where to put output, and so on.

Webpacker introduces a Rails-like concept of environment. It maintains a common environment file, config/webpack/base.js, and then separates additional files for different environments, allowing for different development behavior versus production. This directory also keeps track of loaders, which are the bits of code that attach particular file types to the webpack ...