'Heroku Rails 7 deployment not finding Javascript files (404)
I have a rails app that has javascript working correctly locally but when I push to Heroku it's getting 404s for each of the relative imports in my application.js file:
// Simply importing activates Turbo Drive
import "@hotwired/turbo-rails";
import { Application } from "@hotwired/stimulus";
// Here we use relative imports so these aren't in import map
import HelloController from "./application/hello_controller";
import "./application/logstuff";
import "./application/main";
// Start Stimulus and register controllers
window.Stimulus = Application.start();
window.Stimulus.debug = false; // set true to enable stimulus debugging
Stimulus.register("hello", HelloController);
I have my javascript in app/javascript but the error messages read like the javascript is missing from app/assets/:
GET <url>/assets/application/hello_controller net::ERR_ABORTED 404
Am I missing a config somewhere to switch where to look for the javascript?
Thanks :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
