Rails has retired the webpacker gem and it's general strategy: https://github.com/rails/webpacker. This project made fairly heavy use of webpacker given it was used to compile typescript, react components, JS dependencies, and more.
Continuing to use webpacker is not an option, as it blocks upgrades of many other things, including Node.js, the runtime openssl version, and numerous webpack plugins.
The options to replace webpacker are:
jsbundling-rails: This is a lightweight gem that basically adds yarn build into the rake assets:precompile task. This means most of the asset pipeline is compiled with node tooling (in our case: webpack).
shakapacker: This is the spiritual successor to webpacker. It's bigger, more robust, has more features. We weren't using most of the headline features (code splitting, hot module reloading) anyway, so I thought this might be overkill.
import maps + Hotwire: This is the strategy for Rails 7+. It's targeted more at the Rails app with sprinkled in JS. This isn't appropriate for this app, since nearly all our html is generated by React.
Rails has retired the
webpacker
gem and it's general strategy: https://github.com/rails/webpacker. This project made fairly heavy use ofwebpacker
given it was used to compile typescript, react components, JS dependencies, and more.Continuing to use
webpacker
is not an option, as it blocks upgrades of many other things, including Node.js, the runtime openssl version, and numerous webpack plugins.The options to replace webpacker are:
jsbundling-rails
: This is a lightweight gem that basically addsyarn build
into therake assets:precompile
task. This means most of the asset pipeline is compiled with node tooling (in our case:webpack
).shakapacker
: This is the spiritual successor towebpacker
. It's bigger, more robust, has more features. We weren't using most of the headline features (code splitting, hot module reloading) anyway, so I thought this might be overkill.For the most part, the changes here are the result of the process outlined here: https://github.com/rails/jsbundling-rails/blob/main/docs/switch_from_webpacker.md.
I've deployed this to staging and it works as expected.