mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:21:12 +08:00
DEV: Simplify sprockets configuration (#24111)
- Remove the wildcard crawler. This was already excluding almost all file types, but the exclude list was missing '.gjs' which meant those files were unnecessarily being hoisted into the `public/` directory during precompile - Automatically include all ember-cli-generated assets without needing them to be listed. The main motivation for this change is to allow us to start using async imports via Embroider/Webpack. The filenames for those new async bundles will not be known in advance. - Skips sprockets fingerprinting on Embroider/Webpack chunk JS files. Their filenames already include a fingerprint, and having sprockets change the filenames will cause problems for the async import feature (where filenames are included deep inside js bundles) This commit also updates our ember-cli build so that it skips building plugin tests in the production environment. This should provide a slight build speed improvement.
This commit is contained in:
@ -6,36 +6,7 @@ module EmberCli
|
||||
end
|
||||
|
||||
def self.assets
|
||||
@assets ||=
|
||||
begin
|
||||
assets = %w[
|
||||
discourse.js
|
||||
admin.js
|
||||
wizard.js
|
||||
ember_jquery.js
|
||||
markdown-it-bundle.js
|
||||
start-discourse.js
|
||||
vendor.js
|
||||
]
|
||||
assets +=
|
||||
Dir.glob("app/assets/javascripts/discourse/scripts/*.js").map { |f| File.basename(f) }
|
||||
|
||||
if workbox_dir_name
|
||||
assets +=
|
||||
Dir
|
||||
.glob("app/assets/javascripts/discourse/dist/assets/#{workbox_dir_name}/*")
|
||||
.map { |f| "#{workbox_dir_name}/#{File.basename(f)}" }
|
||||
end
|
||||
|
||||
Discourse
|
||||
.find_plugin_js_assets(include_disabled: true)
|
||||
.each do |file|
|
||||
next if file.ends_with?("_extra") # these are still handled by sprockets
|
||||
assets << "#{file}.js"
|
||||
end
|
||||
|
||||
assets
|
||||
end
|
||||
@@assets ||= Dir.glob("**/*.{js,map,txt}", base: "#{dist_dir}/assets")
|
||||
end
|
||||
|
||||
def self.script_chunks
|
||||
@ -107,4 +78,9 @@ module EmberCli
|
||||
def self.has_tests?
|
||||
File.exist?("#{dist_dir}/tests/index.html")
|
||||
end
|
||||
|
||||
def self.clear_cache!
|
||||
@@chunk_infos = nil
|
||||
@@assets = nil
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user