which you might have to adjust individually for every file. I’m not familiar with this setting, so I can’t be more specific.
Basically, in dev-env, Rails will “dig” through your code and find the respective module. On prod, though, it needs the exact location of the compiled module, which rests under “assets”.
With importmaps I have to list every file individually to work on prod, so maybe it’s similar.
It would seem nothing but application.js is actually deployed/compiled. Again, not familiar with your setup. The files you’re importing must be bundled somehow, though.
Yes, it seems like application.js is not getting compiled.
It still shows as:
// Entry point for the build script in your package.json
import "@hotwired/turbo-rails";
import "./controllers";
import "./parts/dropdown-navigation";
import "./parts/message-boxes";
Still unsure what’s going on but heres some new information:
I did a fresh deploy and it errors. I check the public/assets directory and see application-50290509.js. This is the digest for the below. Ie: the non-compiled file.
// Entry point for the build script in your package.json
import "@hotwired/turbo-rails";
import "./controllers";
import "./parts/dropdown-navigation";
import "./parts/message-boxes";
If I run bundle exec rails assets:clobber to wipe out all the assets and then follow that by bundle exec rails assets:precompile, I check the file listing and now see application-39087e34.js which is the digest of the compiled version, ie: the file we want!
I check the app and look at the source where I see the script tag shows:
Importing the wrong file (which now no longer exists).
What on earth is going on? Why is it failing to precompile that file correctly on deployment but can do it correctly when run manually? It also works fine in development and when I try to precompile locally too.
I have this on Digital Ocean deployed via @excid3 's Hatchbox. I’ve contacted Chris on there and he’s assurred me it’s not Hatchbox.
I’m now very confused as to what’s causing this to occur.
@javinto1 I LOVE YOU! If we ever meet in person, I owe you many beers!
Seriously, Thanks. This has been bugging me for days! Initial test seems like it’s the solution so i’ll do more checks and update in a day or two to confirm.