Open searls opened 3 weeks ago
I forked the repo to try finding a workaround, and was able to get it to load by changing hw_importmap.rb in each of these ways:
pin "hotwire_combobox", to: "hotwire_combobox.esm.js", preload: true
pin "hotwire_combobox", to: "controllers/hw_combobox_controller.js", preload: true
pin_all_from HotwireCombobox::Engine.root.join("app/assets/javascripts/hw_combobox"), under: "hw_combobox", to: "hw_combobox"
This also required me to have an import 'hotwire_combobox'
somewhere in my application.js for them to load, though.
Additionally, (and more importantly), the actual hotwire combobox functionality didn't work. I'm unsure why not and couldn't figure it out
Thanks for raising this and trying to find a workaround.
Yeah, this is a remnant from first spiking on the library and trying a spray approach. I'll have to take a look and see what we need and don't need. UMD is probably fine to drop, and I'd expect ESM to be able to stand on its own, since that's what's published on npm for use in non-importmap apps. But that's evidently not working so something's up.
I'll keep this open while I (or someone else) take a look.
I'm trying to clear these warnings from my browser while debugging my app, because only the admin section of my site currently uses hotwire_combobox:
If you're using importmaps, the importmap.rb:
Will pin and (apparently?) preload both of these files (they aren't checked into the repo, as they're generated):
I guess there are two issues here:
hw_importmap.rb
to only pin the ESM buildAdditionally, by using
pin_all_from
, individualmodulepreload
links are generated for each and every JavaScript file in the project, which is probably not what you want