I have a rails 7 app using importmaps to load JS. Locally my JS is working but when I deploy to production it does not and I get this error in the console
Failed to register controller: home (controllers/home_controller) TypeError: Failed to fetch dynamically imported module: ...assets/controllers/home_controller-316bd3c1b5d71b64f1a80f7345c4de5eb8e6e4a19dcca702b6b3c0c262258d2c.js
I figured this out and wanted to leave something on stack overflow with the solution. It turns out that my controller was importing a module that was using a relative import path. When I fixed that the issue was resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With