diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-05-03 23:13:35 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-05-03 23:13:43 +0300 |
commit | b3734ec8112f53d1b60cce66e806967a0954b301 (patch) | |
tree | ea4db984e7e71be2fb4d2a9741d26b61b701f45f /app/helpers | |
parent | 9328c75e1a8a9ea8c08bd33ac875ac2ce46cbbad (diff) |
prevent duplicate chunks from being loaded in webpack_helper
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/webpack_helper.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/helpers/webpack_helper.rb b/app/helpers/webpack_helper.rb index dfdbc0f8a77..01264f53a40 100644 --- a/app/helpers/webpack_helper.rb +++ b/app/helpers/webpack_helper.rb @@ -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 |