diff --git a/app/helpers/reactjs_helper.rb b/app/helpers/reactjs_helper.rb index 5348c152833..a09381c2372 100644 --- a/app/helpers/reactjs_helper.rb +++ b/app/helpers/reactjs_helper.rb @@ -33,7 +33,7 @@ def read_webpack_manifest def get_webpack_chunk(name, extension) data = read_webpack_manifest - data['assetsByChunkName'][name].find { |value| value.end_with?(".#{extension}") } + data['assetsByChunkName'][name]&.find { |value| value.end_with?(".#{extension}") } end def get_webpack_foreman_vendor_js diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 63d70227bb5..7099e4d458f 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -31,15 +31,15 @@ <%= javascript_include_tag "locale/#{FastGettext.locale}/app" %> <%= locale_js_tags %> - + <%= yield(:head) %> <%= get_webpack_foreman_vendor_js %> - <%= javascript_include_tag('/webpack/vendor.js') %> - <%= javascript_include_tag('/webpack/bundle.js') %> - <%= javascript_include_tag('/webpack/reactExports.js') %> + <%= javascript_include_tag("/webpack/#{get_webpack_chunk('vendor', 'js')}") %> + <%= javascript_include_tag("/webpack/#{get_webpack_chunk('bundle', 'js')}") %> + <%= javascript_include_tag("/webpack/#{get_webpack_chunk('reactExports', 'js')}") %> <%= javascript_include_tag 'application' %> <%= webpacked_plugins_with_global_js %>