Despite how easy it is to create a new Rails application, customization is often required where it falls short. Rails has had a long history of being as unfriendly as possible to Javascript, however in recent times, it has to get on board!
That’s precisely what’s happening now.
Before
To create a new Rails application, all one has to do is:
In this command, it is possible to control the type of DB to configure, the test suite, and more! This would create an app where importmap-rails would handle the JavaScript approach. To override this, one would have to manually remove and add additional code.
After
With Rails 7, we now can create a new Rails application and configure the JavaScript bundler options.
The two other officially supported options are currently webpacker
and esbuild-rails
.
These can be now be controlled via the -j
or --javascript
option with webpack
and esbuild
as the choices.
What’s great about this approach is that it makes Rails much more customizable and open to modifications.
Another related
PR
also added rollup.js
as a JavaScript bundler option.
Hope we see more options in the future!