FIX: Correctly map fingerprinted vendor.js file in production (#24267)

Followup to a0b94dca16
This commit is contained in:
David Taylor 2023-11-07 11:34:19 +00:00 committed by GitHub
parent 039d060832
commit 0889f22a3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,12 @@ class EmberCli < ActiveSupport::CurrentAttributes
value["assets"].map { |chunk| chunk.delete_prefix("assets/").delete_suffix(".js") }
end
# Special case - vendor.js is fingerprinted by Embroider in production, but not run through Webpack
if !assets.include?("vendor.js") &&
fingerprinted = assets.find { |a| a.match?(/^vendor\..*\.js$/) }
chunk_infos["vendor"] = [fingerprinted.delete_suffix(".js")]
end
@production_chunk_infos = chunk_infos if Rails.env.production?
self.request_cached_script_chunks = chunk_infos
rescue Errno::ENOENT
@ -57,7 +63,7 @@ class EmberCli < ActiveSupport::CurrentAttributes
end
def self.clear_cache!
@prod_chunk_infos = nil
@production_chunk_infos = nil
@assets = nil
self.request_cached_script_chunks = nil
end