turbo_power-rails icon indicating copy to clipboard operation
turbo_power-rails copied to clipboard

Installation hiccup on Rails 7 with turbo-rails and importmaps

Open minimul opened this issue 2 years ago • 2 comments

The turbo-rails gem pins thus to the config/importmap.rb file:

pin '@hotwired/turbo-rails', to: 'turbo.min.js', preload: true

When I ran bin/importmap pin turbo_power it did pin a version of @hotwired/turbo but since I didn't want two versions of Turbo, I removed it and received this error:

Uncaught TypeError: Failed to resolve module specifier "@hotwired/turbo". Relative references must start with either "/", "./", or "../".

As a workaround, I just made a "copy" in config/importmap.rb like so:

pin '@hotwired/turbo-rails', to: 'turbo.min.js', preload: true
+pin @hotwired/turbo', to: 'turbo.min.js', preload: true

After that no problems and I've already implemented a .set_attribute() stream. 🚀

Thanks for this great gem and NPM package.

minimul avatar Oct 04 '22 19:10 minimul