DEV: Fix production sourcemaps with Ember CLI (#16707)

22a7905f restructured how we load Ember CLI assets in production. Unfortunately, it also broke sourcemaps for those assets. This commit fixes that regression via a couple of changes:

- It adds the necessary `.map` paths to `config.assets.precompile`
- It swaps Sprockets' default `SourcemappingUrlProcessor` with an extended version which maintains relative URLs of maps
This commit is contained in:
David Taylor
2022-05-11 10:23:32 +01:00
committed by GitHub
parent 0689338060
commit 476bd1d237
6 changed files with 66 additions and 2 deletions

View File

@ -1,6 +1,15 @@
# frozen_string_literal: true
module EmberCli
ASSETS = %w(
discourse.js
admin.js
ember_jquery.js
pretty-text-bundle.js
start-discourse.js
vendor.js
)
ALIASES ||= {
"application" => "discourse",
"discourse/tests/test-support-rails" => "test-support",
@ -36,4 +45,9 @@ module EmberCli
return name if !enabled?
ALIASES[name] || name
end
def self.is_ember_cli_asset?(name)
return false if !enabled?
ASSETS.include?(name) || name.start_with?("chunk.")
end
end