Skip to content

Sprockets erroneously looks for a link to controllers/application.js in config/manifest.js [when Import Maps is also in use] #548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
john-999 opened this issue May 8, 2025 · 0 comments

Comments

@john-999
Copy link

john-999 commented May 8, 2025

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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant