mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 19:29:34 +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:
@ -50,11 +50,14 @@ Sprockets::DirectiveProcessor.prepend(
|
||||
end,
|
||||
)
|
||||
|
||||
# Skip digest path for workbox assets. They are already in a folder with a digest in the name.
|
||||
# Skip sprockets fingerprinting for some assets
|
||||
Sprockets::Asset.prepend(
|
||||
Module.new do
|
||||
def digest_path
|
||||
return logical_path if logical_path.match?(%r{^workbox-.*/})
|
||||
# Workbox assets are already in a folder with a digest in the name
|
||||
return logical_path if logical_path.start_with?("workbox-")
|
||||
# Webpack chunks are already named based on their contents
|
||||
return logical_path if logical_path.start_with?("chunk.")
|
||||
super
|
||||
end
|
||||
end,
|
||||
|
Reference in New Issue
Block a user