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

163 Views Asked by At

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
1

There are 1 best solutions below

0
joshuacronemeyer On

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.