DEV: Display a warning when assets are precompiled in local env (#35323)

When precompiled assets exist, Propshaft will switch to a static mode
and only serve those existing assets. This confuses people on a regular
basis, so this patch addresses that issue by displaying a banner on
STDOUT if precompiled assets exist in a local env (test or dev).
This commit is contained in:
Loïc Guitaut
2025-10-10 17:53:32 +02:00
committed by GitHub
parent 5ccee79387
commit 68c0ca00f3
+8
View File
@@ -222,6 +222,14 @@ module Discourse
controller.action_methods
end
end
puts <<~WARNING if Rails.env.local? && Rails.application.assets.config.manifest_path.exist?
\e[1;31m==========================================================================
WARNING: an asset manifest file exists. This means the assets wont be
compiled automatically, and will be served statically instead.
To re-enable automatic compilation, you can run `bin/rails assets:clobber`
==========================================================================\e[0m
WARNING
end
require "rbtrace" if ENV["RBTRACE"] == "1"