From ec654bc41ac21ba895ae3a56718db63b49db4051 Mon Sep 17 00:00:00 2001 From: Paul Slaughter Date: Tue, 30 Apr 2019 11:32:11 -0500 Subject: [PATCH] Fix webpack asset patch with '/' as relative root https://gitlab.com/gitlab-org/gitlab-ce/issues/60932 --- app/assets/javascripts/lib/utils/webpack.js | 4 +++- .../unreleased/fix-webpack-assets-relative-url-bug.yml | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/fix-webpack-assets-relative-url-bug.yml diff --git a/app/assets/javascripts/lib/utils/webpack.js b/app/assets/javascripts/lib/utils/webpack.js index 37b5409a51d..37b17f0fe23 100644 --- a/app/assets/javascripts/lib/utils/webpack.js +++ b/app/assets/javascripts/lib/utils/webpack.js @@ -1,3 +1,5 @@ +import { joinPaths } from '~/lib/utils/url_utility'; + // tell webpack to load assets from origin so that web workers don't break // eslint-disable-next-line import/prefer-default-export export function resetServiceWorkersPublicPath() { @@ -5,7 +7,7 @@ export function resetServiceWorkersPublicPath() { // the webpack publicPath setting at runtime. // see: https://webpack.js.org/guides/public-path/ const relativeRootPath = (gon && gon.relative_url_root) || ''; - const webpackAssetPath = `${relativeRootPath}/assets/webpack/`; + const webpackAssetPath = joinPaths(relativeRootPath, '/assets/webpack/'); __webpack_public_path__ = webpackAssetPath; // eslint-disable-line camelcase // monaco-editor-webpack-plugin currently (incorrectly) references the diff --git a/changelogs/unreleased/fix-webpack-assets-relative-url-bug.yml b/changelogs/unreleased/fix-webpack-assets-relative-url-bug.yml new file mode 100644 index 00000000000..80936245f3e --- /dev/null +++ b/changelogs/unreleased/fix-webpack-assets-relative-url-bug.yml @@ -0,0 +1,5 @@ +--- +title: Fix webpack assets handling when relative url root is '/' +merge_request: 27909 +author: +type: fixed