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.
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.
I am also running into this issue, and found some very bizarre workarounds.
What I found is that ‘rake assets:precompile’ seems to run fine according to the logs - it seems to run esbuild first and then the sprockets compile. However after deploy, the rails app just gives me the application.js is not present in the asset pipeline error. Even more strangely, when I manually re-run ‘rake assets:precompile’ in a SSH session, and I restart the rails app (kill the puma process), the rails app is now able to find that file, and everything is working.
It gets even weirder.
Since two runs of ‘rake assets:precompile’ seems to work, why not automate? My build script literally has two consecutive lines like this:
I just created an account to reply to you: this is working, and I have no idea WHY! it is driving me crazy. funny thing is that I had the exact SAME issue trying to deploy my app on google cloud, so it could be something with Rails…
Move the tailwind and esbuild compilation steps into a build task, and then enhance the precompile task:
namespace :javascript do
desc "Build your JavaScript bundle"
task :build do
system "npm install && npm run build"
end
end
Rake::Task["assets:precompile"].enhance(["javascript:build"])