This guide provides step-by-step instructions to migration from Webpacker 5 to jsbundling-rails with webpack 5. For upgrading to Webpacker 6 instead, follow this guide or for comparison between Webpacker and jsbundling-rails, see this.
First install jsbundling-rails:
# Add to your Gemfile