Hi folks
I’m using rails 7.0.3. Have been using turbo etc, and I’m using importmaps.
I have a stimulus controller thats working in dev. When I push to production on every page load it fails with the below error. I haven’t even referenced the stimulus controller in any views yet, just testing the deployment. This breaks my chartjs module and none of my charts load. Why would it be trying to GET “/assets/controllers/simulation_controller” instead of " “/assets/controllers/simulation_controller-xxxxx.js”?
[76a77e44-b6e0-4bc3-a964-81dcfd52fce6] ActionController::RoutingError (No route matches [GET] "/assets/controllers/simulation_controller"):
My imports are something as follows. The assets are getting compiled successfully (including the stimulus controller) on my server and I can see them.
"imports": {
"application": "/assets/application-af8bca25858236a09111e5eee2891ccc9212b182025c32e19b97d0c5f121fd13.js",
"@hotwired/turbo-rails": "/assets/turbo.min-f309baafa3ae5ad6ccee3e7362118b87678d792db8e8ab466c4fa284dd3a4700.js",
"@hotwired/stimulus": "/assets/stimulus.min-d03cf1dff41d6c5698ec2c5d6a501615a7a33754dbeef8d1edd31c928d17c652.js",
"@hotwired/stimulus-loading": "/assets/stimulus-loading-1fc59770fb1654500044afd3f5f6d7d00800e5be36746d55b94a2963a7a228aa.js",
"chartkick": "/assets/chartkick-8eb76e6cbdb540d495739fce84049fd038e59e7fd55c9e08e47b0b5a74b62db4.js",
"Chart.bundle": "/assets/Chart.bundle-aed03f096855cf38f5dc8e832bb7c11f7773934dde150c15e94a614abe15802c.js",
"controllers/application": "/assets/controllers/application-368d98631bccbf2349e0d4f8269afb3fe9625118341966de054759d96ea86c7e.js",
"controllers": "/assets/controllers/index-cf30ea7cf1cb68233f232528ed547e6ff01673b3b7377d43c7776218e8fcf5ff.js",
"controllers/simulation_controller": "/assets/controllers/simulation_controller-27d1219dc7415b122fb4cc0c8c8bcf19e08a617667e01757910780245c4930f3.js"
}
}
My controllers/index.js file is
import { application } from "./application"
import SimulationController from "./simulation_controller"
application.register("simulation", SimulationController)
Again, turbo/chart js has been fine and no issues with importmaps.
EDIT: Seems even though the import maps pointing to the right asset file, I can see below in dev tools under sources its throwing the error it cannot find simulation_controller. Will keep investigating.
Any help would be appreciated. Best - Dan