ruby-on-rails Sprockets::Rails::Helper::AssetNotPrecompiledError with Rails 7 and importmap

3pvhb19x  于 2023-04-22  发布在  Ruby
关注(0)|答案(1)|浏览(121)

我从Rails 6升级到了Rails 7,并想设置importmap。
我正在接收Sprockets::Rails::Helper::AssetNotPrecompiledError

Asset was not declared to be precompiled in production.
Add `Rails.application.config.assets.precompile += %w( controllers/hello_controller.js )` 
to `config/initializers/assets.rb` and restart your server

它知道不需要预编译这个文件-我想知道如何关闭通过importmap加载的JS文件的预编译?
我的importmap.rb和新安装的一样:

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

dxpyg8gm1#

Here is a relevant question与一些评论,让我弄清楚我的问题以及。
将链轮更新到4.x解决了问题-升级指南

相关问题