Closed bkuhlmann closed 2 years ago
In the meantime, here's a workaround that we've been using within our own codebase to avoid downgrading the gem:
# lib/tasks/css_build_workaround.rake
namespace :css do
desc "Workaround for css:build"
task :build_workaround do
system("yarn install")
end
end
Rake::Task["css:build"].enhance ["css:build_workaround"]
So this is fixed on rails/main via https://github.com/rails/rails/pull/43641. But yeah, need to come up with a solution where we're not running yarn install twice on Rails 6.1.4 but also dealing with the fact that bin/yarn might not be there. cc @zarqman
Reverted via https://github.com/rails/cssbundling-rails/commit/b1a456287d3df1560947c8bbb0858518ae51dad8 for now.
I think the correct solution for double yarn install is to zero out yarn:install for Rails 6.1.x (it's already not used with rails/main).
Overview
I'm afraid the 0.2.5 patch introduced a bug with asset compilation both for local development and when deploying to Heroku in which the
yarn
binary can no longer be found.Steps to Recreate
To recreate, run
rails css:build
locally and you'll now see the following output in your console:While the above isn't a catastrophic failure locally, it does crash Heroku deployments (might affect other server too). Here's an example where you can see the above failure but via my CLI when talking to a Heroku Stage server:
Desired Behavior
I don't know if a revert of the above patch is necessary but maybe we need to split compilation between a development and production environment for deployment purposes? Either that or fix the root problem where Rake can't detect the
yarn
binary?Environment