Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to fetch dynamically imported module with Rails 7 importmaps/stimulus app

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
like image 526
joshuacronemeyer Avatar asked Nov 29 '25 17:11

joshuacronemeyer


1 Answers

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.

like image 114
joshuacronemeyer Avatar answered Dec 01 '25 08:12

joshuacronemeyer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!