One option is you could disable the asset pipeline:
config.assets.enabled = false
Alternatively, if you don't use the Rails Asset Pipleine (sprockets
, sprockets-rails
) at all, you can remove those gems. That will remove the assets:precompile
Rake task, and Heroku will skip it because it can't find it (source - since Rails 4)
Remove sprockets
and sprockets-rails
to remove the definition of assets:precompile
. The bad news is that there's no way to easily remove just these gems since they come pre-packaged with rails
. And by default rails
requires several gems, including the rake task. However, you can opt to list out rails dependencies by name individually, and you can exclude sprockets
from the list:
require 'rails'
require 'active_record/railtie'
require 'active_storage/engine'
require 'action_controller/railtie'
require 'action_view/railtie'
require 'action_mailer/railtie'
require 'active_job/railtie'
require 'action_cable/engine'
require 'action_mailbox/engine'
# require 'sprockets/railtie' <--- Comment out or remove this
require 'action_text/engine'
require 'rails/test_unit/railtie'
NOTE: As of 7.0.0-alpha3
, sprockets
is automatically excluded. See the commit that removed sprockets
, from DHH