dant
dant

Reputation: 61

ActionController::RoutingError stimulus-loading.js importmap-rails

I'm using Rails 6.1 with @hotwired/stimulus and importmap.

I'm getting this error in dev env.

ActionController::RoutingError (No route matches [GET] "/assets/stimulus-loading.js")

importmap.rb:

pin "application"
pin "@hotwired/stimulus", to: "stimulus.js"
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
pin_all_from "app/javascript/controllers", under: "controllers"
pin "@hotwired/turbo-rails", to: "turbo.js"

The temporary solution is to set the stimulus-loading precompiled file:

pin "application"
pin "@hotwired/stimulus", to: "stimulus.js"    
pin "@hotwired/stimulus-loading", to: "/assets/stimulus-loading-1fc59770fb1654500044afd3f5f6d7d00800e5be36746d55b94a2963a7a228aa.js"
pin_all_from "app/javascript/controllers", under: "controllers"
pin "@hotwired/turbo-rails", to: "turbo.js"

The only 'pin' which is failing is stimulus-loading.js. why? I already followed https://github.com/hotwired/stimulus-rails Any help, idea or comment is very welcome. Thanks for your time!

Gems:

'ruby' '2.6.8'
'rails', '~> 6.1'
'importmap-rails'
'stimulus-rails'
'turbo-rails'

Upvotes: 6

Views: 565

Answers (1)

quentic
quentic

Reputation: 66

Seems that this solved the problem for me. Try adding to config/environnement/development.rb the following clause:

 config.assets.debug = true

Upvotes: 0

Related Questions