Note: This isn't really a jsbundling-rails issue, but I figured this is going to be fairly common issues as more folks are upgrading Rails / Heroku legacy apps from webpack to jsbundling w/ esbuild or alternative tools.
We are working on converting to esbuild away from webpack / rails-webpacker for a large-ish app that is deployed to Heroku.
So far almost everything is working, but we are seeing multiple calls to yarn install in Heroku deploys now in our esbuild branch. I'm wondering if there is a way to avoid this with Heroku when having both the nodejs and ruby buildpacks installed? The double installs aren't really a problem, but they do clutter up our logs and add time to deployments.
I read through https://github.com/rails/jsbundling-rails/issues/16, and also scanned through the node and ruby buildpack code, but don't see any clear way to tell one or the other to be the 'winner' and the only tool that handles running yarn install.
From what I can tell, the nodejs buildpack sees that we have a a package.json with a build task, so it installs node and yarn and then executes yarn run.
Then the ruby buildpack detects the ruby app, and runs the assets precompile task, which again runs the same steps (which I believe jsbundling-rails wires up).
I suppose we could try to explicitly clear out the precompile task in Rails land, but that feels pretty hacky and not a good long-term solution.
Is there an ENV var or flag we could set to tell the nodejs task to not try to build things, and instead let the ruby build pack be the 'builder' ?
Note: This isn't really a jsbundling-rails issue, but I figured this is going to be fairly common issues as more folks are upgrading Rails / Heroku legacy apps from webpack to jsbundling w/ esbuild or alternative tools.
We are working on converting to esbuild away from webpack / rails-webpacker for a large-ish app that is deployed to Heroku.
So far almost everything is working, but we are seeing multiple calls to
yarn install
in Heroku deploys now in our esbuild branch. I'm wondering if there is a way to avoid this with Heroku when having both the nodejs and ruby buildpacks installed? The double installs aren't really a problem, but they do clutter up our logs and add time to deployments.I read through https://github.com/rails/jsbundling-rails/issues/16, and also scanned through the node and ruby buildpack code, but don't see any clear way to tell one or the other to be the 'winner' and the only tool that handles running
yarn install
.From what I can tell, the nodejs buildpack sees that we have a a package.json with a
build
task, so it installs node and yarn and then executes yarn run.Then the ruby buildpack detects the ruby app, and runs the assets precompile task, which again runs the same steps (which I believe jsbundling-rails wires up).
I suppose we could try to explicitly clear out the precompile task in Rails land, but that feels pretty hacky and not a good long-term solution.
Is there an ENV var or flag we could set to tell the nodejs task to not try to build things, and instead let the ruby build pack be the 'builder' ?
Here are our buildpacks btw:
And here is the output of a recent heroku deploy showing the multiple calls to yarn install.