Rails 7: How can I remove Turbo completely?
Asked Answered
P

2

10

I have a Rails 7 application. After some development I see that Turbo (Hotwired) creates too many issues and I don't need it for this application.

Is there any way to remove Turbo completely from an existing Rails app?

What is the recommended way to remove it?

Professionalize answered 14/1, 2022 at 18:14 Comment(0)
G
14

You need to remove gem "turbo-rails" from the Gemfile, run bundle install to update the dependencies. Also run

bin/importmap unpin @hotwired/turbo-rails
bin/importmap unpin @hotwired/stimulus
bin/importmap unpin @hotwired/stimulus-loading

and remove import "@hotwired/turbo-rails" from app/javascript/application.js

Galangal answered 15/1, 2022 at 6:14 Comment(2)
Also remove "data-turbo-track": "reload" from your stylesheet_link_tag in your application.html.erb.Svend
In order for Jquery to work you also need to remove (or otherwise deal with...but I removed it) the gem "stimulus-rails" gem, which works with Turbo.Svend
C
1

If you are creating a brand new Rails app, you can also do this with the --skip-hotwire option on rails new:

rails new --skip-hotwire
Claud answered 4/8 at 19:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.