I wrote a whole post back in 2020 explaining Webpacker - packs, javascript_pack_tag, config/webpacker.yml, the lot. Consider this the follow-up nobody asked for: Webpacker is dead, and honestly, good riddance.

A short history

Rails 6 made Webpacker the default JavaScript compiler. It worked, but it dragged the entire Node ecosystem into every Rails app - a package.json, a node_modules folder the size of a small moon, and webpack config that nobody fully understood.

In 2021 the Rails team officially retired the gem. If you have a legacy app that genuinely needs it, the community fork is Shakapacker - but for everything else there are better options now.

What Rails uses today

Since Rails 7, the default is import maps. Your JavaScript is served as-is, ES modules straight to the browser, no build step at all:

bin/importmap pin local-time

That pins a library, downloads it into vendor/javascript, and you import it like any module. For most apps - Hotwire, Turbo, Stimulus and a sprinkle of custom JS - this is genuinely all you need.

When you do need a bundler

If you’re transpiling TypeScript or JSX, reach for jsbundling-rails instead:

rails new myapp -j esbuild
# or -j bun if you're feeling modern

You get a proper bundler, but it stays out of the way - one build script in package.json, output into app/assets/builds, and the asset pipeline (Propshaft these days, Sprockets is gone too) takes it from there.

Migrating off Webpacker

The short version of my own migrations: move files out of app/javascript/packs into app/javascript, swap javascript_pack_tag for javascript_include_tag (or javascript_importmap_tags), delete config/webpacker.yml, babel.config.js, postcss.config.js, then enjoy deleting node_modules and watching your disk space come back.

The whole JS-in-Rails story went from the most painful part of the framework to a thing I don’t think about any more. Progress.