Install Gem
bundle add shakapackerJavaScript Bundling for Rails
Official docs for installing, configuring, deploying, and upgrading Shakapacker in Rails applications, with first-class Rspack support.
bundle add shakapackerbin/rails shakapacker:installbin/rails assets:precompileNew in v10.1
Shakapacker 10.1 adds two supplemental packages — shakapacker-rspack and shakapacker-webpack — that carry the managed build stack as required peer dependencies. Install one package instead of wiring up four.
npm install --save-dev shakapacker-rspack
npm 7+ auto-installs the required peers: @rspack/core, @rspack/cli, and rspack-manifest-plugin.
yarn add --dev shakapacker-rspack shakapacker @rspack/core @rspack/cli rspack-manifest-plugin
pnpm add --save-dev shakapacker-rspack shakapacker @rspack/core @rspack/cli rspack-manifest-plugin
Defaults to Rspack — it ships SWC, so there’s no separate transpiler to install. Unlike npm 7+, Yarn and pnpm can’t rely on the one-package install, so their commands list the bundler peers and shakapacker explicitly; the Rails installer (bin/rails shakapacker:install) writes them into your package.json for you either way.
Prefer webpack? Swap in shakapacker-webpack for the managed webpack stack.
Already on Shakapacker 10.0? Collapse four dependencies into one — your shakapacker.yml and build configs stay unchanged.
Shakapacker ships with first-class Rspack support — a Rust-powered bundler that’s wire-compatible with Webpack 5 but dramatically faster. Switch bundlers with a one-line config change; no migration rewrite needed.
Rspack is wire-compatible with Webpack 5. Existing loaders, plugins, and config files work without rewriting your build pipeline.
Written in Rust, Rspack delivers dramatically faster cold starts, warm-cache rebuilds, and incremental production builds compared to Webpack.
Unlike Vite, Rspack works with Shakapacker out of the box — no ejecting from the Rails asset pipeline, no custom server configuration.
2-4x build speed increase. Warm-cache startup went from ~1m to ~20s, and incremental prod builds now take ~10s.
Jon Rajavuori — ShakaCode helped Academia.edu migrate from Webpack to Rspack
Sprockets and Propshaft are Rails’ asset-digesting layer — they fingerprint assets but don’t bundle JavaScript. importmap-rails, jsbundling-rails, Vite Ruby, and Shakapacker are how modern JS actually reaches the browser.
| Option | Build step | npm + loaders | JSX / TS | HMR | Code splitting | Rails manifest + helpers | Best for |
|---|---|---|---|---|---|---|---|
| Sprockets | none (concatenate) | ✗ | ✗ | ✗ | ✗ | ✓ (legacy) | Legacy apps, CSS / images |
| Propshaft | none (digest only) | ✗ | ✗ | ✗ | ✗ | ✓ | Modern digesting; pair with a bundler |
| importmap-rails | none | ✗ | ✗ | ✗ | ✗ | ✓ (Propshaft) | No-build Hotwire |
| jsbundling-rails | esbuild / rollup / bun | minimal | ✓ | ✗ | limited | ✓ (Propshaft) | Simple modern JS |
| Vite Ruby | Vite | Vite ecosystem | ✓ | ✓ | ✓ | own pipeline | Teams wanting Vite DX |
| Shakapacker + Rspack | webpack or Rspack | full ecosystem | ✓ SWC / Babel / esbuild | ✓ | ✓ | ✓ native | Complex / React / TS at scale |
Installation, configuration, and deployment guidance is sourced directly from the shakapacker/docs tree.
Keep webpack-style configuration and Rails conventions while switching the build engine to Rspack for major speed gains.
Canonical markdown stays in shakapacker/docs. This site syncs that content at build time, so docs stay co-located with the code while deployment remains independent.
Expert Help
Planning a Webpack-to-Rspack migration or troubleshooting production builds? Book a complimentary 30-minute assessment with ShakaCode.