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.
Yeah migrating my Rails 5 system to Webpacker from the pipeline was not smooth and you're right, Rails ended up adopting a system that is configuration hell.
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.
I had a similar nightmarish experience migrating a few Rails apps from 4.x to 5.x. Because of the complexity and size of our apps, it took a few months to successfully complete and test. Luckily we had copious rspec tests with decent code coverage. I too dislike the troubling trend of not being able to directly access JavaScrips directly from the view; I am not sure why this is done, but it makes debugging much more difficult.
More abstraction is not more better.
In any case, we will eventually have to migrate to 6.x, so that will be fun.
I have two applications in the wild— one a monorepo with a rails API and front end built with deploy scripts, and one with rails Webpacker. The Webpacker one feels like I have an arm tied behind my back. There’s a bunch of ‘Rails way’ extras I have to do to keep things ‘organized’, but I don’t even get proper state-maintaining hot reloading in dev. It does smooth over some rough edges (though through magic) but the next one will probably prefer the self-management strategy.
I spent a ton of time writing custom asset management in rails 2.x days. It was kind of fun. I think you can still use rails 3/4 style assists in rails 6?
I haven't had to upgrade to 6, so it's a bummer to hear it's so painful. On a fresh Rails 6 project built with "--webpack=stimulus", I haven't had to muck with Webpack (on two ongoing products and a handful of experimental/toy codebases) and Stimulus has been just a delight. Everything more or less "just works".
Webpacker docs (or even in general) is a bit painful I agree. I don't think Rails had a lot of options there, chasing the constantly involving js world was hard (Sprockets is very limited in what it can do).
I think the docs and best practices will improve but yeah I feel your pain.
That was my experience as well. Usually upgrading years old codebase to the bleeding edge took way less than expected. Webpack on the other hand is a different beast to handle and a challenge in itself.
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.