Alpha preview: Converting a import-mapped React app to use esbuild with JSX in Rails 7

Поделиться
HTML-код
  • Опубликовано: 2 янв 2025
  • Start a Rails 7 app with the importmap default is no risk, as you can easily move to a bundler/transpiler setup later if you need to.
    Previous videos:
    Introduction to import maps in Rails 7: • Alpha preview: Modern ...
    Building React components with import maps: • Alpha preview: Using R...

Комментарии • 18

  • @broqoli
    @broqoli 3 года назад +5

    Man, I love that Ruby has evolved (and Rails by nature) to handle JavaScript as an asset to be loaded and managed by the framework itself.

  • @AvidRambo
    @AvidRambo 3 года назад +1

    Excited for the future of Rails.

  • @SebastienSaunier
    @SebastienSaunier 3 года назад +5

    Thanks for sharing your thought process on how importmap is being built into rails 7! I wonder if we could plug the `esbuild` to the `assets:precompile` step like it's done by webpacker at the moment, I don't feel comfortable committing a generated file like `application.js` into git, it would pollute the Pull Requests.

    • @davidheinemeierhansson9989
      @davidheinemeierhansson9989  3 года назад +17

      Yes, you can just add a rake task that attaches to assets:precompile that calls "npm run build" and then add app/assets/javascripts/application.js to your .gitignore.

    • @ignacioalonsol
      @ignacioalonsol 3 года назад

      👀

  • @duztdruid
    @duztdruid 3 года назад +2

    Wonderful stuff. Any rationale for defaulting to jspm over eg. jsdeliver or skypack?

  • @een_schildpad
    @een_schildpad 3 года назад +1

    Heck yeah, exciting stuff! I love the new "pin" bin script; it feels like a fun "familiar" way to add dependencies. I need to pull down the latest Rails master into my side project and start working with this 🚀 It will feel so good to rip out webpack 😜

  • @drale2k
    @drale2k 3 года назад +1

    Let's go baby Rails 7 and beyond

  • @the_wrong_folder
    @the_wrong_folder 2 года назад

    is React+Rails popular enough now that we'll see a template available from the cli? (something like rails new-with-react myapp)

  • @szojordan
    @szojordan 2 года назад

    Great video, how can we setup hot module reloading so changes in react code reflects directly on browser without refresh?

  • @siyaram2855
    @siyaram2855 2 года назад

    Hey DHH, is it worth it? Isn't hotwire enough?

  • @scotteisenberg8422
    @scotteisenberg8422 2 года назад

    I’m getting errors on the 2nd part of the example, the one with the jsx. How about publishing a GitHub with the code for this?

  • @noname99noname
    @noname99noname 2 года назад

    For a simple Hello world, 1 MB js file needed. what would be for large application?

  • @ebk0
    @ebk0 2 года назад

    How do you deploy this? Running into major errors with deploying- this is the error: Uncaught SyntaxError: Cannot use import statement outside a module (referring to the app/javascript/application.js file).

  • @amani_art
    @amani_art 3 года назад +1

    Nice. I'm happy again

  • @sovietwarmachine1979
    @sovietwarmachine1979 3 года назад

    Sir, do you have a ballpark estimation on when rails 7 will be out?

  •  3 года назад

    I just followed this video on my computer, and I am receiving an error on clock.js file Uncaught SyntaxError: Unexpected token '

    • @szojordan
      @szojordan 2 года назад

      You are placing JSX without a bundler, thats why DHH used htm before introducing esbuild