DEV: Do not run ember-cli output through terser again (#15889)

ember-cli already runs terser on its output. Running it through again provides no benefit, takes longer, and also breaks source mapping of these assets in production.
This commit is contained in:
David Taylor 2022-02-10 15:35:54 +00:00 committed by GitHub
parent 9610aea189
commit abefb1beff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -38,8 +38,7 @@ task 'assets:precompile:before' do
if ENV['EMBER_CLI_PROD_ASSETS'] != "0"
# Remove the assets that Ember CLI will handle for us
Rails.configuration.assets.precompile.reject! do |asset|
asset.is_a?(String) &&
(%w(application.js admin.js ember_jquery.js pretty-text-bundle.js start-discourse.js vendor.js).include?(asset))
asset.is_a?(String) && is_ember_cli_asset?(asset)
end
end
end
@ -82,6 +81,11 @@ task 'assets:flush_sw' => 'environment' do
end
end
def is_ember_cli_asset?(name)
return false if ENV['EMBER_CLI_PROD_ASSETS'] == '0'
%w(application.js admin.js ember_jquery.js pretty-text-bundle.js start-discourse.js vendor.js).include?(name)
end
def assets_path
"#{Rails.root}/public/assets"
end
@ -162,6 +166,7 @@ end
def max_compress?(path, locales)
return false if Rails.configuration.assets.skip_minification.include? path
return false if is_ember_cli_asset?(path)
return true unless path.include? "locales/"
path_locale = path.delete_prefix("locales/").delete_suffix(".js")