Shakapacker is the official, actively maintained successor to rails/webpacker that integrates Webpack v5+ (or Rspack for 10x faster builds) with Rails for managing app-like JavaScript modules. Version 10.0.0 requires Node >=20 and supports Rspack v2, esbuild, and SWC loaders. Released by ShakaCode with regular cadence (v9.6.2 latest stable, v10.0.0 recent), it provides a robust Ruby gem and npm package for configuration, asset manifest generation, and development server integration. Key differentiators: native Rspack support, semantic config diffing (bin/diff-bundler-config), and compatibility with jsbundling-rails alternatives. Ships TypeScript types.
npm install shakapackerVerified import paths — ran on the pinned version, not inferred.
Shows basic imports from shakapacker npm package: main export, deployment, and config subpaths.
Update Node to 20.x or later. Verify with node --version.
Replace event-based hooks with direct method overrides in ShakapackerConfig subclass.
Switch to import { shakapacker } from 'shakapacker' in ESM context, or use dynamic import() if mixed.Add '@rspack/core' to dependencies. If using webpack, ignore this warning.
Uncomment 'headers' section in config/shakapacker.yml to restore Access-Control-Allow-Origin: *.
Run 'yarn add shakapacker@^10.0.0' or 'npm install shakapacker@^10.0.0'.
Replace 'bin/shakapacker --watch' with 'bin/shakapacker-watch --watch' in Procfile or CLI.
Update webpack config to use cacheGroups instead of chunks. Refer to webpack 5 migration guide.
Upgrade to shakapacker v9.6.1+ which adds defined?(Rails) guard, or manually set RAILS_ENV.