Struggling with esbuild

Struggling with esbuild

With the arrival of Rails 7.0, i have tried moving from webpack to esbuild but struggle with it.

  1. I understand how to load jquery or jqueryui (and now datatables) but how do i load flatpickr? Dropzone? Select2? And globally any other library? https://flatpickr.js.org https://www.dropzone.dev https://select2.org

  2. I know that theoretically import jquery from “jquery” window.jQuery = jquery window.$ = jquery Should make $ available in the views… but sometimes it doesnt but i have no idea why (even if esbuild compiles) Any idea how to troubleshoot?

@Cedric_Lefebvre

  1. Why do you need to switch away from webpack?
  2. If you like, you can try out shakapacker (new webpacker) support for esbuild and we’ll give you a hand to make this work. We’ve got a Slack discussion linked in the README.