Alpha preview: Modern JavaScript in Rails 7 without Webpack

Sdílet
Vložit
  • čas přidán 15. 08. 2021
  • 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...
  • Věda a technologie

Komentáře • 132

  • @portlime
    @portlime Před 2 lety +29

    The time of endlessly waiting for webpack re-compiling is over. This is great.

    • @adriantomole1019
      @adriantomole1019 Před 2 lety

      I only used that feature only when I continued the work of other ppl. Glad I can get rid of it.

    • @lulakales
      @lulakales Před 2 lety

      Try vite ruby, you don't need to wait!

  • @anthonypetruzzi158
    @anthonypetruzzi158 Před 2 lety +12

    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 🤣

  • @aftakitani
    @aftakitani Před 2 lety +24

    This is awesome! Cant wait to put my hands on it and do an rm -rf node_modules

  • @bjornforsberg1
    @bjornforsberg1 Před 2 lety +54

    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 👏

    • @jamescattanach1129
      @jamescattanach1129 Před 2 lety

      Does it? I can't get importma-rails to work in a rails 7 alpha 2 engine. How did you achieve this?

    • @wotok7
      @wotok7 Před 2 lety

      @@jamescattanach1129 hmmm, just sneak peeked rails 7 alpha 2 right now and it works

    • @jamescattanach1129
      @jamescattanach1129 Před 2 lety +1

      @@wotok7 not in rails engines it doesn't

  • @sadiqmmm
    @sadiqmmm Před 2 lety +54

    Unbelievable. Rails has become the best framework.

    • @EmanueleTozzato
      @EmanueleTozzato Před 2 lety +33

      Always has been!

    • @terryhenyo9216
      @terryhenyo9216 Před 2 lety +2

      Laravel: Hold my beer...

    • @yeco
      @yeco Před 2 lety +1

      Laughs in Spring. But seriously though, rails is such a beauty.

    • @bravenetmarketing
      @bravenetmarketing Před 2 lety

      (looks at my Grails app ... looks at my work's Rails app) ... yeah, no, not so much, actually.

    • @TheJackTheLion
      @TheJackTheLion Před 2 lety

      @@bravenetmarketing 🤣😂🤣😂🤣Right...

  • @baseddepartment1306
    @baseddepartment1306 Před 2 lety +3

    Exiting news... I'm really looking forward to Rails 7

  • @KonstantinSkobeltsyn
    @KonstantinSkobeltsyn Před 2 lety

    Great stuff. Great thinking! Working with Rails since 2012, thank you very much for your work!

  • @abidiqbal6122
    @abidiqbal6122 Před 2 lety +2

    You are a true gem David!!! Keep up the good work 👏

  • @misbehavens
    @misbehavens Před 2 lety +21

    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.

  • @een_schildpad
    @een_schildpad Před 2 lety +3

    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 🔥

    • @asadali8446
      @asadali8446 Před 2 lety

      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.

    • @_unknown_guy
      @_unknown_guy Před 2 lety

      @@asadali8446 guess we stick to webpack in that case.

  • @henrymendez6799
    @henrymendez6799 Před 2 lety

    Thanks! I see that you solve things that are a bit complicated when it comes to javascript and that's very good.

  • @pcorral
    @pcorral Před 2 lety

    This is great. Looking forward to start to use Rails 7 without webpack.

  • @desireco
    @desireco Před 2 lety

    Always wonderful Dev experience with Rails

  • @AndrewOgryzek
    @AndrewOgryzek Před 2 lety +2

    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.

  • @pioztube
    @pioztube Před 2 lety +4

    Amazing, good job David!

  • @repoles
    @repoles Před rokem

    Amazing! Simplicity is everything! 👏

  • @nitrosnowbs
    @nitrosnowbs Před 2 lety +4

    Awesome! Great to see that there is now an easy way to use vueJS with rails! Hype!!

    • @sukotu23
      @sukotu23 Před 2 lety

      How does this change adding Vue to Rails? Are there any examples of Rails 7 with Vue?

  • @JarmamStuff
    @JarmamStuff Před rokem

    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

  • @dra11y
    @dra11y Před 2 lety +3

    This is so awesome! Can the ESM/importmap gems be backported to work with Rails 6 as well?

  • @rainerborene
    @rainerborene Před 2 lety +6

    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
      @lubomirherko7331 Před 2 lety +4

      I'd guess that CDN will serve already minified dependencies, if needed.

    • @tomasvalent3876
      @tomasvalent3876 Před 2 lety

      @@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)

  • @estuardohernandez4230
    @estuardohernandez4230 Před 9 měsíci

    Pretty good video.

  • @tomasvalent3876
    @tomasvalent3876 Před 2 lety

    New hairstyle & new Rails style :) I like it. Just one question. What will you recommend for CSS (custom & lib css)? Sprockets?

  • @IgorKasyanchuk
    @IgorKasyanchuk Před 2 lety +2

    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.

  • @kwhandy
    @kwhandy Před 2 lety

    that fighting image is really interesting for me. you guys fight apple but even use apple products to make this intros. I am cracked😂

  • @koenhandekyn
    @koenhandekyn Před 2 lety +5

    Very nice , but as heroku is still pending HTTP2 support - this seems key in the decision to make it a default?

  • @christianmartinez2179
    @christianmartinez2179 Před 2 lety

    "Modern JavaScript in rails..."
    You had my curiosity
    "...without webpack" but now, now you have my attention

  • @americosavinon
    @americosavinon Před 2 lety

    This is great stuff David

  • @Mixesha001
    @Mixesha001 Před 2 lety +2

    Sold on leaving Webpack which was just a nightmare in certain cases. Not sold about the CDN for the librairies.

  • @jaynews9495
    @jaynews9495 Před 2 lety +1

    i'd like my gravestone to read: "goodbye world. sad"

  • @TheGrandWhiteFox
    @TheGrandWhiteFox Před 2 lety

    Can't wait to try it!

  • @ppavelcars
    @ppavelcars Před 2 lety +1

    This is great news!
    Thanks!

  • @donGiulio
    @donGiulio Před 2 lety

    thanks for this video, It's been released and I'm trying it now. a question is this just for js or does it affects also css?

  • @foobar1269
    @foobar1269 Před 2 lety

    Wow love this video. Thanks for the information

  • @martijnlafeber1008
    @martijnlafeber1008 Před 2 lety +2

    This is the way.

  • @VoodooSoulMusic
    @VoodooSoulMusic Před 2 lety

    Love the React Ideas

  • @vinogradova82
    @vinogradova82 Před 2 lety

    This is really cool! Love Rails ;)

  • @airtonbrunobr
    @airtonbrunobr Před rokem

    I knowing that not going use the Webpack, I already stay happy 😁. Simply amazing. I really liked a lot. Bye Webpack!

  • @Spharian
    @Spharian Před 2 lety +6

    Neat! What about working on the app with no internet connection (or issues)? CDN will make it impossible, no?

  • @kannans6026
    @kannans6026 Před 2 lety

    This is so awesome... Great news..

  • @jaojao6955
    @jaojao6955 Před 2 lety +1

    legendary

  • @muratustuntas6809
    @muratustuntas6809 Před 2 lety

    Finally. bye bye webpack, welcome importmap. I am so glad...

  • @okoni.alesre
    @okoni.alesre Před 2 lety +4

    Goodbye Webpack!!!🔥🔥🔥🔥👍

  • @embuscadafe2804
    @embuscadafe2804 Před 2 lety +1

    Tão incrível que quase chorei!

  • @pyetrobr
    @pyetrobr Před 2 lety +17

    I luv Rails, The best framework, just missing, automatic server restart.

  • @davosonic60
    @davosonic60 Před 2 lety

    Hahahaha, loved the David vs Goliath picture

  • @phanhaiquang
    @phanhaiquang Před 2 lety

    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 ???

  • @phanhaiquang
    @phanhaiquang Před 2 lety +2

    If we change a js lib version, and few other libs depend on previous version, then we might need to manage these stuff manually ?

  • @user-od9du2wx7r
    @user-od9du2wx7r Před 2 lety

    Nice to see modern approach! But is that true that development is possible only online because of CDNs usage? Or I missed something?

    • @dghimsami9068
      @dghimsami9068 Před 2 lety

      you can always download dependencies with "--download " option for example:
      ./bin/importmap pin react --download
      packages are downloaded to "vendor/javascript"

  • @gradientO
    @gradientO Před 2 lety +1

    Knew about this earlier via yo newsletter lol

  • @ahmad_hamza
    @ahmad_hamza Před 2 lety

    This is very neat!

  • @TheJackTheLion
    @TheJackTheLion Před 2 lety +1

    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.

  • @kickedoutonthestreets
    @kickedoutonthestreets Před 2 lety +2

    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.

    • @kohlerm113
      @kohlerm113 Před 2 lety

      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

  • @mohamadnorouzi3278
    @mohamadnorouzi3278 Před 2 lety

    that david and goliath picture :)

  • @foxtail3296
    @foxtail3296 Před 2 lety

    OMG. Amazing !!!

  • @MrKeliv
    @MrKeliv Před 2 lety +1

    How to add TailwindCSS in rails 7 ? I still cannot find any tutorial how to add it

  • @dmitriyobidin6049
    @dmitriyobidin6049 Před 2 lety

    The only thing i don't get: how hotwire will work with vue? Or we should only use one of them?

  • @faizan2006
    @faizan2006 Před 2 lety

    This is Awesome..

  • @arpysemlac
    @arpysemlac Před 5 měsíci

    Do you ever unit test the javascript code? If yes could you provide an example how you do it with this approach?

  • @syritsyn
    @syritsyn Před 2 lety

    HOLY SMOKES CANT BELIEVE MY EYES

  • @alhafoudh
    @alhafoudh Před 2 lety +1

    But what about TypeScript? Our rails stack has all JS done via TypeScript.

  • @yesyesyay8452
    @yesyesyay8452 Před 2 lety +1

    Leaving my job to pursue Master of Rails Development :)

  • @chrisr236
    @chrisr236 Před 2 lety

    I didn't know browsers were ready for this

  • @haroldpepete
    @haroldpepete Před 2 lety

    you don't have to use npm or any javascript package manager, that part like me a lot, and app are ready to go easily

  • @xiaohuizhang7004
    @xiaohuizhang7004 Před 2 lety

    Finally, goodbye Webpack 👏👏👏

  • @terryhenyo9216
    @terryhenyo9216 Před 2 lety +1

    It's nice that Rails is catching up to Laravel already. Laravel is like Rails' once nerdy younger sister who grew up to be a beauty queen.

    • @Pau1danelli
      @Pau1danelli Před 2 lety +8

      It’s still PHP though, which means that beauty queen sister is actually a really high maintenance diva.

  • @whyimustusemyrealname3801

    what a tasty omakase thanks dhh

  • @torvic99
    @torvic99 Před 2 lety

    YAY!!!

  • @dlvl86
    @dlvl86 Před 2 lety

    Awesome

  • @et_matrix
    @et_matrix Před rokem

    I dunno I am not new to Rails but i can't able to use Vue in my Rails 7 project.

  • @l0rdxar
    @l0rdxar Před 2 lety

    it is a great video :)

  • @BrettCoffin
    @BrettCoffin Před 2 lety +3

    Typescript ?

  • @sunsampicesg
    @sunsampicesg Před 2 lety +1

    awsome cool feature, How to fit PWA application for rails application? Mobile android app TWA rails application how this technology are fit Rails application

  • @wbjxfkwsklejfde34d
    @wbjxfkwsklejfde34d Před 11 měsíci

    🥳

  • @CharlesDv
    @CharlesDv Před 2 lety +2

    Dear Webpack: "get the f**k outta you here!".

  • @pabloalejandrotapia8813

    Great video, but the example doesn't work. Trix can't show the image in the show action, it only show the image in the edit action...

  • @blargh123123123
    @blargh123123123 Před 2 lety +4

    Is it safe to assume we'd still need webpack to use something like React that presumably still needs to be transpiled?

    • @blargh123123123
      @blargh123123123 Před 2 lety

      Got to the end of the video and apparently it does work, just without JSX.

    • @Frexuz
      @Frexuz Před 2 lety

      @@blargh123123123 not really, you have to re-write all components to use React.createElement..

  • @lulakales
    @lulakales Před 2 lety +2

    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.

    • @kosnk
      @kosnk Před 2 lety

      Didn't know about Vite Ruby, thanks for sharing!

  • @al-mokhtar_
    @al-mokhtar_ Před 2 lety

    but why not ruby 3 ?

  • @JustBCWi
    @JustBCWi Před 2 lety +1

    CDNs? What if we are 100% on premise?

    • @davidheinemeierhansson9989
      @davidheinemeierhansson9989  Před 2 lety +2

      Download the files from the CDNs, place them in vendor/assets/javascripts/, pin that.

    • @JustBCWi
      @JustBCWi Před 2 lety +2

      @@davidheinemeierhansson9989 You, sir, are awesome. Thank you for the answer, and all the passion funneled into Ruby & Rails. :)

  • @remove_top
    @remove_top Před 2 lety

    wow

  • @vicpra
    @vicpra Před 2 lety

    Just need run the app without install the packages after pull.

  • @jajejijoju7874
    @jajejijoju7874 Před 2 lety +5

    Downloading the latest random JS library from a CDNs sounds like a huge security nightmare waiting to happen

    • @kohlerm113
      @kohlerm113 Před 2 lety

      You can pin versions. You just have to make sure to use a known good version

  • @jeremyward9363
    @jeremyward9363 Před 2 lety +2

    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:

  • @udonwadon2045
    @udonwadon2045 Před 2 lety

    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!

  • @StruC
    @StruC Před 2 lety +17

    Using CDNs for JS libraries exclusively sounds like a GDPR and security nightmare waiting to happen.

    • @NotVersace
      @NotVersace Před 2 lety +8

      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.

    • @SebastienSaunier
      @SebastienSaunier Před 2 lety +8

      I think you still can vendor the JS dependencies if you don’t want to rely on an third-party CDN.

    • @KasperGrubbe
      @KasperGrubbe Před 2 lety

      You can just vendor them and self-host.

    • @bjornforsberg1
      @bjornforsberg1 Před 2 lety +1

      You certainly can :) The stimulus-rails gem repo is a good example of how that is done.

    • @phanhaiquang
      @phanhaiquang Před 2 lety +1

      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.

  • @foobar1269
    @foobar1269 Před 2 lety

    Yesss ES6 finally Microsoft

  • @lordsharshabeel
    @lordsharshabeel Před 2 lety +1

    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?

  • @nickm4064
    @nickm4064 Před 2 lety +2

    Can we pretty please fast-forward to Rails 9 so all that hotwire/stimulus/reflex gunk gets spit out too.

  • @TheaWorld
    @TheaWorld Před rokem

    CDN for libraries .... hmmm...

  • @collimarco
    @collimarco Před 2 lety +1

    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.

  • @desireco
    @desireco Před 2 lety

    ERB color scheme is jarring

  • @1jcc
    @1jcc Před 2 lety +2

    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.

    • @kohlerm113
      @kohlerm113 Před 2 lety +1

      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)

    • @lordsharshabeel
      @lordsharshabeel Před 2 lety

      Rails has always carried the bias of having no respect for Javascript, or anything that might sully its perfectly crafted Ruby castle.

  • @Lucas-bh3et
    @Lucas-bh3et Před 2 lety

    Typescript ?