rails/webpacker

Future support and long term mantability, will this webpacker be deprecated? Asking for 100M user migration

gastonmorixe opened this issue ยท 6 comments

Hi community,

A client of mine has a site with around 100M users which is considering moving to React and we need Webpack to integrate we Rails. It's a top website in the world and decisions must be taken carefully.

We are using Rails 3 and plan to upgrade everything. We are considering all options to integrate JS with Rails and the easiest by far is using this gem. Sadly after a few comments from @dhh here, which don't get me wrong I agree with most of them, my team is discouraged of using this gem and want to explore other options.

My question is simply how do you see long term maintainability of this gem? specially after the drop of default in Rails 7.

As of today webpacker ranks #517 with 39,439,103 downloads.

Thank you so much for your time

My opinion:

  1. they said webpacker will still be part of rails and as of speaking there are no plans of a removal. It will just no longer be the default (as it happened with sprockets for javascript - and sprockets is still there)
  2. if you need built-in support in rails, webpacker is still the only way you can integrate a complex frontend. Sprockets has its serious limitations with modern javascript, and the new default javascript approach for Railsv7 is only focused on that: javascript. Which may be good, if you just need javascript (using sprockets for (s)css). But if you have a more complex setup (linting, fonts, iconfonts, assets, sass, SSR for SPA etc.) there is currently no way around webpack (and thus webpacker)
  3. using webpacker v5: I would agree that there is a risk involved there, because Rails did "invent" its own logic, wrapper and DSL around webpack. Using webpacker v6 (not yet released) is not so much of a risk. It is built as a very, very thin layer above webpack. This means we have three advantages:
  • we can use the full power of webpack, because we have "full" access. We can use documentation of the loaders without having to translate everything into "Rails-webpack-DSL"
  • webpacker itself should be fairly unexpensive / easy to maintain (!) (due to its "thin" nature)
  • if (!) webpacker gets deprecated / unmaintained at one point, it should be feasible to continue using webpack without webpacker with reasonable efforts

@Eusebius1920 Thank you for pointing out about the upcoming v6 re-write as a 'thin' layer. Thank you very much for your detailed answer.

Thank you @Eusebius1920, I couldn't have said it better! ๐Ÿ‘

dhh commented

Webpacker v6 is a great option for those who want to continue on that track. But it will no longer be bundled with Rails 7. The path we're going with by default going forward is import maps (no Node required at all) and then jsbundling-rails as the step from there. But you don't need anyone's permission to continue to use Webpacker if you fancy. The gem will still be there, and v6 is a much slimmer fit than v5 was.

Thank you for your words @dhh

@gastonmorixe In case you didn't see, v6 got released as https://github.com/shakacode/shakapacker. ๐Ÿš€