PERF: Update ember-auto-import (#15814)

This makes a small improvement to 'cold cache' ember-cli build times, and a large improvement to 'warm cache' build times

The ember-auto-import update means that vendor is now split into multiple files for efficiency. These are named `chunk.*`, and should be included immediately after the `vendor.js` file. This commit also updates the rails app to render script tags for these chunks
This commit is contained in:
David Taylor
2022-02-04 11:00:51 +00:00
committed by GitHub
parent f3467ee673
commit f4c6a61855
13 changed files with 1737 additions and 120 deletions

View File

@@ -135,6 +135,22 @@ module ApplicationHelper
path
end
def preload_vendor_scripts
scripts = ["vendor"]
if ENV["EMBER_CLI_PROD_ASSETS"] == "1"
@@vendor_chunks ||= begin
all_assets = ActionController::Base.helpers.assets_manifest.assets
all_assets.keys.filter_map { |name| name[/\A(chunk\..*)\.js\z/, 1] }
end
scripts.push(*@@vendor_chunks)
end
scripts.map do |name|
preload_script(name)
end.join("\n").html_safe
end
def preload_script(script)
path = script_asset_path(script)
preload_script_url(path)