title: In Rails 7 with esbuild build, how do I run a script of esbuild fails?
body: <p>I have this script that runs when running Rails 7 with esbuild build, this is inside <code>package.json</code> in the scripts attribute, it's ran from the Rails procfile:</p>
  <p><code>esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds</code></p>
  <p>however I often find myself with errors with file configs, however the website I'm working on does not show any errors because the last build was there and working.</p>
  <p>I'd like the webpage to bread if there's an esbuild error.</p>
  <p>I was wondering how do I run another script that deleted the previous build, I tried this:</p>
  <p><code>esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --onFailure \&quot;rm ./app/assets/builds/application.js &amp;&amp; rm ./app/assets/builds/application.js.map\&quot;</code></p>
  <p>However it's saying <code>onFailure</code> is an invalid flag.</p>
  <p>Is there a way to make esbuild show the error on the site, or just show any error if the build fails?</p>