Skip to content

A platform for community discussion. Free, open, simple.

DEV: Recover from missing ember-cli assets in development (#32625)

David Taylor4490a529762d
diff --git a/lib/freedom_patches/propshaft_patches.rb b/lib/freedom_patches/propshaft_patches.rb
index 218b2660743..24440bb6151 100644
--- a/lib/freedom_patches/propshaft_patches.rb
+++ b/lib/freedom_patches/propshaft_patches.rb
@@ -11,9 +11,15 @@ Propshaft::Asset.prepend(
Propshaft::Helper.prepend(
Module.new do
def compute_asset_path(path, options = {})
+ attempts = 0
super
rescue Propshaft::MissingAssetError => e
- if Rails.env.test?
+ if Rails.env.development?
+ # Ember-cli might've replaced the assets
+ Rails.application.assets.load_path.send(:clear_cache)
+ attempts += 1
+ retry if attempts < 3
+ elsif Rails.env.test?
# Assets might not be compiled in test mode. Just return a fake path
"/assets/#{path.sub(".", "-aaaaaaaa.")}"
else