Modern web apps without JavaScript bundling or transpiling: world.hey.com/dhh/modern-web-... Rails 7 minus Webpack plus importmap PR: github.com/rails/rails/pull/4...
One of the beautiful thing things about this approach is that it works REALLY well with rails engines and gem assets.. which has been a nightmare (near impossible) with Webpack 👏
i might not do rails anymore day to day, but i still always love watching DHH videos and him demonstrating the new hottest that will be shipped. it reminds me of the first video he ever did when he was introducing rails way back in 2004 or something. Keep up with the videos DHH... only thing I can recommend for them, is you need more "whoops" in them 🤣
Very cool. Webpack has been a pain in my side. Looking forward to moving to something simpler, especially in regards to Rails engines/gems providing their own javascript.
Exciting stuff, thanks for the alpha preview!! Seems like some really awesome possibilities here; I'm starting to catch the vision 🚀 I'm still trying to wrap my head around using CDNs for dependencies, it feels a little uncomfortable at the moment but it might just be because I haven't thought that way before. It's certainly given me something to think about! Also, I'm definitely going to steal that bash alias of "r" for the "bin/rails" command that it looks like you have 🔥
I also feel same......being in Europe most projects are very strict about using external service providers (including CDNs). I am also confused what are the options if someone is bound to provide a self compiled/hosted js libraries.
Very nice video! Great explanations, and I love the overall style of it. I'm curious as to why you've mentioned that you might have difficulty using JSX, when you could just source Babel, and let it know to transpile whatever you wanted it to.
What if we wrapped html body with a turbo and consider html/css content as a special model? Then, do we have a “hot reload” feature? It means that what we change on server html/css code will be push to local and re-render ???
This is amazing! I'm looking forward to see Basecamp and HEY running on this new architecture. One question though.. Sprockets still takes care of minification?
@@lubomirherko7331 I wonder if sprockets would be preferred to write custom css (I'm guessing yes, it works well) Then the question would be what if you need to change sass variables (e.g. Bootstrap button colors) Then you cannot load css from CDN but from your sprockets (which is absolutely fine)
I've only just started working in Rails 7 with Hotwire a few weeks back, but I must say that this Rails version + the amazing speed of Ruby 3 for esp tests - it has done wonders for the joy of developing. I did Vue on Rails for years, and it is perfectly functional, but this just feels so much smoother. Config Hell is barely a thing. Im delighted for what Webpack was able to do for so long, but I would be lying if I said I'd miss it in the light of importmaps
With CDNs, how do we customize how much lib we want to include? For example what if I only want to import just Bootstrap's dropdown from Bootstrap's CDN.
Some CDNs (skypack does) allow you to specify an internal path of a file to load within the package. That being said, I would expect that it might be necessary to load more than one file in one request, which isn't supported in skypack
I love that you see hundreds of devs using crazy IDE's or VSCode, etc all crazy looking and flashy. And then you see DHH just using TextMate 😂 This says volumes about his view on simplicity.
Please make more videos like this. They are very informative and could help the community. Show more videos how you developing new things, best practices, refactoring.
you can always download dependencies with "--download " option for example: ./bin/importmap pin react --download packages are downloaded to "vendor/javascript"
Soooooo now we are removing webpacker? Just as I recommended moving from the asset pipeline bc rails 6 moved from the asset pipeline to webpacker. :sigh:
Does it save js libraries locally? Sometimes there are corporate rules, that everything must be served locally and I would consider it to be painful to save it all manually. I may be in the opposition, but I actually like to work with node modules, I find it much easier to install and use packages. The only problem with webpack might be its configuration and time consuming bundling process for development. Speaking of this, I recently started to use Vite Ruby and I consider it superb. If I understand it correctly, it uses modules as in the video for development, but bundles the code for production and is easy to configure and so all the unpleasant things gone away with it. I actually don't even use Sprockets for styles or images and am using all assets under /assets dir with Vite.
awsome cool feature, How to fit PWA application for rails application? Mobile android app TWA rails application how this technology are fit Rails application
No more bundling, except of course that random third party CDN you're relying on to perform your bundling. Meanwhile, you have no insight or control over your production app's dependency graph that would otherwise be generated from an npm lockfile. Why not just throw out your Gemfile while you're at it?
How so? These assets were already rendered to FE so nothing is accessible that shouldn't be and we can just host libraries on our own CDNs so we control the domains.
I think we could add a signature or checksum hash to make browser realizes the unofficial JS lib. Just the same way if we import a JS purely into a html.
Great, I really hate the messy Javascript ecosystem and Webpack in particular... It goes against the principles of Rails. If other communities jump from the bridge, we don't have to follow them.
This is such a positive experience from the webpacker hell this whole fucking frontend industry is going towards. I'm so tired of having to COMPILE/TRANSPILE JS!
I'm not certain that this is the correct approach. Javascript and its ecosystem are becoming more dominant in development. Much more so than Ruby/Rails. So is the right strategy to try to avoid it as much as possible? I think the correct approach is to do the opposite. Rails needs to integrate Node and Webpack even more so that Rails won't become obsolete. Make React the default when scaffolding for example.
Webpack shows it's age and there are much faster alternatives (such as esbuild) which skipped some old features. I think using Urls and map them to simple imports is the way to go. Just check golangs approach for modules. That being said I still think a dependency description is needed (similar to go.mod)