Webpack Integration with a Gem

In terms of sprockets and the asset pipeline, I’m mostly interested in just eliminating the following steps:

  1. Need to run webpack -w to build the rails-bundle.js
  2. Need to add custom rake task for precompiling for production.

While the Webpack ecosystem offers tons more that overlaps with the Rails Asset Pipeline (fingerprinting, minification, etc.), I’m not sure if there’s a compelling case to change those parts. Note, the Asset Pipeline was broken out into the sprockets gem.

The key features that make me want to use Webpack are:

  1. The JS loaders (es6 transpiler and JSX)
  2. The ability to quickly prototype JS code outside of Rails.