diff --git a/app/assets/javascripts/jira_connect/index.js b/app/assets/javascripts/jira_connect/index.js index dc8bb3b0c77355a18a914ad59926b2fcace08613..bc0d21c6c9af71fae326f3bfe79d82490b22f30d 100644 --- a/app/assets/javascripts/jira_connect/index.js +++ b/app/assets/javascripts/jira_connect/index.js @@ -1,3 +1,5 @@ +import '../webpack'; + import setConfigs from '@gitlab/ui/dist/config'; import Vue from 'vue'; import { getLocation, sizeToParent } from '~/jira_connect/utils'; diff --git a/app/assets/javascripts/performance_bar/index.js b/app/assets/javascripts/performance_bar/index.js index d8aab25a6a8a81873019242768433b80e7b95c5b..66e999ca43b0fec54cc806e77cc3d6477cff799d 100644 --- a/app/assets/javascripts/performance_bar/index.js +++ b/app/assets/javascripts/performance_bar/index.js @@ -1,3 +1,5 @@ +import '../webpack'; + import Vue from 'vue'; import axios from '~/lib/utils/axios_utils'; import { numberToHumanSize } from '~/lib/utils/number_utils'; diff --git a/app/assets/javascripts/sentry/index.js b/app/assets/javascripts/sentry/index.js index 06e4e0aa507ab289b7804e28f7b6ef4135d01ac6..a875ef840888b003832df175105bc3a4be783f18 100644 --- a/app/assets/javascripts/sentry/index.js +++ b/app/assets/javascripts/sentry/index.js @@ -1,3 +1,5 @@ +import '../webpack'; + import SentryConfig from './sentry_config'; const index = function index() { diff --git a/app/assets/javascripts/webpack.js b/app/assets/javascripts/webpack.js index 4f55884335712207b91e66bda6ec52cdefbf76b6..b901f17790ff6555115dc1716cce172d9e9b90b4 100644 --- a/app/assets/javascripts/webpack.js +++ b/app/assets/javascripts/webpack.js @@ -2,6 +2,9 @@ * This is the first script loaded by webpack's runtime. It is used to manually configure * config.output.publicPath to account for relative_url_root or CDN settings which cannot be * baked-in to our webpack bundles. + * + * Note: This file should be at the top of an entry point and _cannot_ be moved to + * e.g. the `window` scope, because it needs to be executed in the scope of webpack. */ if (gon && gon.webpack_public_path) { diff --git a/config/webpack.config.js b/config/webpack.config.js index db5371a7258ab91a0276f0ae12cda79068b84704..c2af7197f94bc7dbc2a2e96e32bc8a6af3f255ce 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -103,6 +103,15 @@ function generateEntries() { autoEntries[entry] = defaultEntries.concat(entryPaths); }); + /* + If you create manual entries, ensure that these import `app/assets/javascripts/webpack.js` right at + the top of the entry in order to ensure that the public path is correctly determined for loading + assets async. See: https://webpack.js.org/configuration/output/#outputpublicpath + + Note: WebPack 5 has an 'auto' option for the public path which could allow us to remove this option + Note 2: If you are using web-workers, you might need to reset the public path, see: + https://gitlab.com/gitlab-org/gitlab/-/issues/321656 + */ const manualEntries = { default: defaultEntries, sentry: './sentry/index.js', diff --git a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb b/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb index de425dde6c0bc0476186380671c7d6a3fc9d8c65..a0f613cfda2ae7b6cdc32dfdf7784f87a6a90dfd 100644 --- a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb +++ b/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb @@ -20,7 +20,7 @@ module QA end end - it 'shows results for the original request and AJAX requests', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/478', quarantine: { only: { pipeline: :main }, issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/323051', type: :bug } do + it 'shows results for the original request and AJAX requests', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/478' do # Issue pages always make AJAX requests Resource::Issue.fabricate_via_browser_ui! do |issue| issue.title = 'Performance bar test'