Sprockets erroneously looks (in config/manifest.js) for a link to controllers/application.js (whose JS files are loaded already via config/importmaps.rb):
<%= javascript_importmap_tags %> raises the error:
Sprockets::Rails::Helper::AssetNotPrecompiledError in Root#index
Asset `controllers/application.js` was not declared to be precompiled in production.
Declare links to your assets in `app/assets/config/manifest.js`.
//= link controllers/application.js
and restart your server
However, controllers/application.js has nothing to do with Sprocket's JS files - it contains JS files which are loaded via Import Maps (config/importmaps.rb).
So, Sprockets should never look for controllers/application.js in config/manifest.js (especially not when Import Maps is configured).
Environment:
- Gem 'sprockets-rails': '3.5.2'
- Rails: 7.2.2.1
- Ruby: 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]