Configuring Webpacker
A Rails 6.1 app installs Webpacker as part of the default app creation; however, you need to make some configuration changes up front to install Hotwire, and make sure that CSS and TypeScript are properly integrated.
Webpacker is a Rails gem, so the default install puts it into your Gemfile:
| | gem "webpacker" |
As I write this, Webpacker 6.0 is in beta. This book uses Beta 6—hopefully it will be released by the time you read this.
Webpacker creates a number of local configuration files, including the package.json manifest of JavaScript libraries to use, and then retrieves those JavaScript libraries using the Yarn package manager.[24]
The default installation of Webpacker does not integrate with TypeScript or with CSS libraries. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access