Skip to content

Commit 4490a52

Browse files
DEV: Recover from missing ember-cli assets in development (#32625)
1 parent 832eefd commit 4490a52

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/freedom_patches/propshaft_patches.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ def already_digested?
1111
Propshaft::Helper.prepend(
1212
Module.new do
1313
def compute_asset_path(path, options = {})
14+
attempts = 0
1415
super
1516
rescue Propshaft::MissingAssetError => e
16-
if Rails.env.test?
17+
if Rails.env.development?
18+
# Ember-cli might've replaced the assets
19+
Rails.application.assets.load_path.send(:clear_cache)
20+
attempts += 1
21+
retry if attempts < 3
22+
elsif Rails.env.test?
1723
# Assets might not be compiled in test mode. Just return a fake path
1824
"/assets/#{path.sub(".", "-aaaaaaaa.")}"
1925
else

0 commit comments

Comments
 (0)