我使用Rails 6.1和@hotwired/stimulus以及importmap。
我在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"
临时解决方案是设置刺激加载预编译文件:
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"
唯一失败的'pin'是stimulation-loading.js。为什么?我已经关注了https://github.com/hotwired/stimulus-rails任何帮助,想法或评论都是非常欢迎的。谢谢你的时间!
宝石:
'ruby' '2.6.8'
'rails', '~> 6.1'
'importmap-rails'
'stimulus-rails'
'turbo-rails'
1条答案
按热度按时间2sbarzqh1#
似乎这为我解决了问题。尝试在config/configuration/development.rb中添加以下子句: