title: 404 errors on javascript when using importmaps in Rails 7 in production
body: <p>I'm not sure if this is an importmaps issue or something else, but in Rails 7.0.0.alpha2, I'm getting 404 errors on the javascript files.</p>
  <p><a href="https://i.stack.imgur.com/3aN4K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3aN4K.png" alt="enter image description here" /></a></p>
  <p>Wondering if I'm missing some sort of production &quot;compile&quot; step as it works fine in development.</p>
  <pre class="lang-rb prettyprint-override"><code># app/javascript/application.js
  import &quot;@hotwired/turbo-rails&quot;
  import &quot;controllers&quot;
  
  
  # app/javascript/controllers/index.js
  import { application } from &quot;./application&quot;
  
  import VoteController from &quot;./vote_controller.js&quot;
  application.register(&quot;vote&quot;, VoteController)
  
  
  # app/javascript/controllers/vote_controller.js
  import { Controller } from &quot;@hotwired/stimulus&quot;
  
  // Connects to data-controller=&quot;vote&quot;
  export default class extends Controller {
    static targets = [&quot;element&quot;];
  
    toggle(event) {
      //event.preventDefault();
      event.target.classList.add(&quot;opacity-100&quot;);
      event.target.classList.remove(&quot;opacity-0&quot;);
    }
  }
  
  
  # config/importmap.rb
  pin &quot;application&quot;, preload: true
  pin &quot;@hotwired/turbo-rails&quot;, to: &quot;turbo.js&quot;
  pin &quot;@hotwired/stimulus&quot;, to: &quot;stimulus.js&quot;
  pin &quot;@hotwired/stimulus-loading&quot;, to: &quot;stimulus-loading.js&quot;
  pin_all_from &quot;app/javascript/controllers&quot;, under: &quot;controllers&quot;
  </code></pre>
  <p>Then in my <code>app/views/layouts/application.html.erb</code> file I'm using <code>&lt;%= javascript_importmap_tags %&gt;</code> to include it all.</p>
  <p>If I set <code>config.assets.compile = true</code> in <code>production.rb</code>, the errors go away...but I'm not sure why or if that's fixing the core issue.</p>