prevent duplicate chunks from being loaded in webpack_helper

This commit is contained in:
Mike Greiling 2018-05-03 15:13:35 -05:00
parent 9328c75e1a
commit b3734ec811
No known key found for this signature in database
GPG key ID: 0303DF507FA67596

View file

@ -33,7 +33,7 @@ module WebpackHelper
javascript_include_tag(*chunks)
end
def entrypoint_paths(source, extension: nil)
def entrypoint_paths(source, extension: nil, exclude_duplicates: true)
return "" unless source.present?
paths = Gitlab::Webpack::Manifest.entrypoint_paths(source)
@ -46,7 +46,14 @@ module WebpackHelper
paths.map! { |p| "#{force_host}#{p}" }
end
paths
if exclude_duplicates
@used_paths ||= []
new_paths = paths - @used_paths
@used_paths += new_paths
new_paths
else
paths
end
end
def webpack_public_host