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

Open
@john-999

Description

@john-999

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions