Has anyone see this…
I have 2-3 existing Stimulus controller (created previously). These load fine.
Today I created a couple new Stimulus controllers. But these are not being linked in <head> and, thus, not loading at all.
Here’s <head>:
What’s missing here are element_closer_controller.js, share_controller.js, full_screen_controller.js, and xxx_controller.js.
All of those were created today.
I’ve tried:
- Restarting
bin/dev
- Clearing the browser cache (and testing in an “icognito” window)
- Completely turning off my content security policy (
config/initializers/content_security_policy.rb)
Nothing.
I’m guessing I must have something mis-configured. Or something changed since I created those other Stimulus controllers. But what that is isn’t obvious to me at the moment.
Has anyone experienced this problem?
More information:
I just noticed this in the server log:
Importmap skipped missing path: controllers/full_screen_controller.js
Importmap skipped missing path: controllers/element_closer_controller.js
Importmap skipped missing path: controllers/share_controller.js
Importmap skipped missing path: controllers/xxx_controller.js
That explains why these are not showing up in <head>. But it’s still not clear why these specifically are “missing”.
P.S. When I physically delete the app/assets/javascript/controllers/xxx_controller.js the message:
Importmap skipped missing path: controllers/xxx_controller.js
Is not reported any longer. Suggesting something is seeing these files but reporting them as “missing”.

Additional digging points to importmaps being the cause.
bin/importmap json
{
"imports": {
"application": "/assets/application-bfcdf840.js",
"@hotwired/turbo-rails": "/assets/turbo.min-ad2c7b86.js",
"@hotwired/stimulus": "/assets/stimulus.min-4b1e420e.js",
"@hotwired/stimulus-loading": "/assets/stimulus-loading-1fc53fe7.js",
"controllers/application": "/assets/controllers/application-3affb389.js",
"controllers/date_and_time_validator_controller": "/assets/controllers/date_and_time_validator_controller-e1f29627.js",
"controllers/deleted_marker_controller": "/assets/controllers/deleted_marker_controller-0583adf0.js",
"controllers": "/assets/controllers/index-ee64e1f1.js",
"controllers/table_form_controller": "/assets/controllers/table_form_controller-d0ca5ed9.js"
}
}
This does not include the newest Stimulus controllers.

I suspect this may have something to do with the content_security_policy in config/initializers/content_security_policy.rb where these are set:
config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
config.content_security_policy_nonce_directives = %w(script-src style-src)
But what’s odd is that even when I completely turn off the CSP, it still doesn’t work.
This is getting more baffling.
I’m trying to walk through the importmap-rails code starting with javascript_importmap_tags (and trying to find my way down to resolve_asset_path where the warning appears to come from.)
The method javascript_importmap_tags starts with Rails.application.importmap which, when I look in the console, does have all of the Stimulus controllers.
This is baffling.