talira

Shakapacker

Use Webpack to manage app-like JavaScript modules in Rails

open sourceMITself-hostablefree

Shakapacker is the maintained successor to rails/webpacker: it connects a Rails app to webpack 5 or Rspack through a manifest, with view helpers that include the built bundles, installer tasks, binstubs and a config/shakapacker.yml, while leaving the bundler's own config open to customize. Version 10 supports Rspack, which the project cites as up to 17 times faster than webpack, and documents moving from one to the other. ShakaCode maintains it alongside React on Rails.

Problems it solves

  • webpacker is retired and I need a replacement for my Rails app
  • bundle React and TypeScript for a Rails app with webpack
  • move my Rails app's webpack build to Rspack for faster builds
  • include hashed JavaScript and CSS bundles in Rails views
  • a dev server with hot reloading for the JavaScript in a Rails app
  • keep full control of the webpack config but get Rails integration
  • compile front-end assets during a Rails deploy

Features

  • webpack 5 and Rspack
  • manifest-backed view helpers
  • installer and binstubs
  • config/shakapacker.yml
  • dev server
  • Node package API
  • config diff between webpack and Rspack

Capabilities

Has a command line toolplan not known

Alternatives

The same job

These do what Shakapacker does.

  1. Importmap for Rails Use ESM with importmap to manage modern JavaScript in Rails without transpiling or bundling
  2. Propshaft Deliver assets for Rails

Compare Shakapacker with the top 3