From b2d90ea1fb16ec4db441c86262191a093401b962 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 27 Apr 2018 17:09:05 -0500 Subject: [PATCH] ensure parent entrypoint is loaded if direct one is unavailable --- app/helpers/webpack_helper.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/helpers/webpack_helper.rb b/app/helpers/webpack_helper.rb index 2f556559c6b..30cd8c90008 100644 --- a/app/helpers/webpack_helper.rb +++ b/app/helpers/webpack_helper.rb @@ -15,12 +15,18 @@ module WebpackHelper end route = [*controller.controller_path.split('/'), action].compact - entrypoint = "pages.#{route.join('.')}" - begin - chunks = entrypoint_paths(entrypoint, extension: 'js') - rescue Gitlab::Webpack::Manifest::AssetMissingError - # no bundle exists for this path + until chunks.any? || route.empty? + entrypoint = "pages.#{route.join('.')}" + begin + chunks = entrypoint_paths(entrypoint, extension: 'js') + rescue Gitlab::Webpack::Manifest::AssetMissingError + # no bundle exists for this path + end + route.pop + end + + if chunks.empty? chunks = entrypoint_paths("default", extension: 'js') end