How do these new tools compare with the old? Versus Webpack, Vite etc?
How do these new tools compare with the old? Versus Webpack, Vite etc?
1. Your frontend js needs are pretty minimal and you don't want something approaching a single-page app. In this case, you lean into Turbo and Stimulus to have rails do most things for you that would previously have been done with some a heavy-weight react-based frontend.
2. Your frontend js needs are significant and you do want a single-page app. In this case, ignore/disable turbo + stimulus. Instead, build your rails app as just a json API and then have a separate project for your frontend built using a dedicated frontend build tool like vite/CRA/webpack/etc.
On one hand, I feel like the turbo/stimulus stuff is the rails community preferring to pretend that the JS world doesn't exist. On the other hand, maybe it's really just the rails world embracing the above dichotomy: they're tools for doing some light frontend work with no JS, and an acceptance of the fact that if you want an SPA, there are better non-rails tools that you'll wind up using anyway.
37Signals have both their Basecamp and Hey.com products which act very much like a single page app but only using Turbo and Stimulus.
I think the rails devs believe that single page apps are overused and the majority of functionality can be done using just the provided tools.
No luck for you then. Rails doesn't seem to love typescript: https://github.com/rails/importmap-rails/issues/124