Commit b3734ec8 authored by Mike Greiling's avatar Mike Greiling

prevent duplicate chunks from being loaded in webpack_helper

parent 9328c75e
...@@ -33,7 +33,7 @@ module WebpackHelper ...@@ -33,7 +33,7 @@ module WebpackHelper
javascript_include_tag(*chunks) javascript_include_tag(*chunks)
end end
def entrypoint_paths(source, extension: nil) def entrypoint_paths(source, extension: nil, exclude_duplicates: true)
return "" unless source.present? return "" unless source.present?
paths = Gitlab::Webpack::Manifest.entrypoint_paths(source) paths = Gitlab::Webpack::Manifest.entrypoint_paths(source)
...@@ -46,7 +46,14 @@ module WebpackHelper ...@@ -46,7 +46,14 @@ module WebpackHelper
paths.map! { |p| "#{force_host}#{p}" } paths.map! { |p| "#{force_host}#{p}" }
end end
paths if exclude_duplicates
@used_paths ||= []
new_paths = paths - @used_paths
@used_paths += new_paths
new_paths
else
paths
end
end end
def webpack_public_host def webpack_public_host
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment