| Forgive the slight tangent but I'd like to talk about Rails in general: Just last night I was migrating an app from Rails 4 to 6.1 - I have been using rails since 0.9, but I think my long relationship is coming to an end. What I loved about Rails was that it built a web framework with the same basic idea as Ruby: optimize for developer happiness. Trying to use the webpack integration (released with Rails 5.1 I think) is a nightmare. Suddenly my clean Ruby world is polluted by JavaScript package hell, there are now two parallel asset pipelines with subtly different behavior, I can no longer reference JavaScript directly in my views, and the convention over configuration Rails approach seems to have been superseded by a tool with the most nightmarish proliferation of necessary configs that I've ever seen. To top this all off, none of this is documented well in any of the official Rails resources. The Rails JavaScript guide mostly focuses on their rails-UJS tool (which is fine, though also lacking in actual API documentation) and makes no mention of any of the webpacker stuff. The only docs I could find were in half finished pull requests in forked repositories, and some brief notes in markdown files. Before starting with Rails 6, I was excited to try out the new Stimulus.js, and hopefully the improvements derived from Hey.com. Now I want to tear out every bit of JavaScript integration from the framework and manage those assets entirely on my own. |
All that said - I love Stimulus.js and Webpacker now that I fought through all the insanity (Webpack configs are nightmare of splicing and trying to reference relative folders either in node_modules or some alias located... well webpack doesn't know...)
If you're on the fence, migrate the entire thing to Webpack - forcefully, with prejudice. Living in both assets pipeline and webpacker is a mental duality that don't co-mingle.
By forcefully, I mean copy/paste raw assets instead of relying on their package that sticks it into the old pipeline.
Stimulus is nutso lightweight and "just makes sense". Everything is self contained.