Rails 7 & ESbuild

Has anyone successfully tried to deploy Rails 7 Alpha with ESBuild?

I have the following render-build.sh file, but it doesn’t seem to make the assets available:

#!/usr/bin/env bash

# exit on error

set -o errexit

bundle lock --add-platform x86_64-linux

bundle install

bundle exec rake assets:precompile

bundle exec rake assets:clean

./node_modules/.bin/esbuild app/javascript/*.* --bundle --outdir=app/assets/builds

./node_modules/.bin/tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css

bundle exec rake db:migrate

Hello!

I was able to make a Rails 7 Alpha test app with ESBuild, although I didn’t add anything in particular to my render-build.sh file - it just matches what’s in our docs example.

Have you tried starting a new project with the command rails project-name --database=postgresql esbuild --css tailwind before deploying to Render? I’m not sure if you were starting from a fresh project or migrating an older one, so I’m curious to see the results.

(post deleted by author)

Hello! I had the same issue than you. Happened when migrating from importmaps to esbuild and ignoring the generated js because it’s too big and recreate it in the render-build script.

What I did is to use the esbuild bundle command before the assets:precompile command so it actually creates the file. Then on the config/assets.rb file I included the file by name. That will precompile it along and include it in the prod app.