mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 10:57:04 +08:00
DEV: Ensure Embroider sourcemaps are collected by Sprockets (#23468)
Names of sourcemaps are not necessarily equal to the js file names. Instead, we can check the `sourceMappingURL` comment to find the map's filename.
This commit is contained in:
parent
754cd9cd22
commit
75ce01a69b
|
@ -59,6 +59,10 @@ module EmberCli
|
|||
{}
|
||||
end
|
||||
|
||||
def self.parse_source_map_path(file)
|
||||
File.read("#{dist_dir}/assets/#{file}")[%r{^//# sourceMappingURL=(.*)$}, 1]
|
||||
end
|
||||
|
||||
def self.is_ember_cli_asset?(name)
|
||||
assets.include?(name) || name.start_with?("chunk.")
|
||||
end
|
||||
|
|
|
@ -53,9 +53,9 @@ task "assets:precompile:before": "environment" do
|
|||
require "digest/sha1"
|
||||
|
||||
# Add ember cli chunks
|
||||
Rails.configuration.assets.precompile.push(
|
||||
*EmberCli.script_chunks.values.flatten.flat_map { |name| ["#{name}.js", "#{name}.map"] },
|
||||
)
|
||||
chunk_files = EmberCli.script_chunks.values.flatten.map { |name| "#{name}.js" }
|
||||
map_files = chunk_files.map { |file| EmberCli.parse_source_map_path(file) }
|
||||
Rails.configuration.assets.precompile.push(*chunk_files, *map_files)
|
||||
end
|
||||
|
||||
task "assets:precompile:css" => "environment" do
|
||||
|
|
Loading…
Reference in New Issue
Block a user