2019-04-30 16:32:11 +00:00
|
|
|
import { joinPaths } from '~/lib/utils/url_utility';
|
|
|
|
|
2021-02-16 15:09:50 +00:00
|
|
|
/**
|
|
|
|
* Tell webpack to load assets from origin so that web workers don't break
|
|
|
|
* See https://gitlab.com/gitlab-org/gitlab/-/issues/321656 for a fix
|
|
|
|
*/
|
2019-02-08 14:06:24 +00:00
|
|
|
export function resetServiceWorkersPublicPath() {
|
|
|
|
// __webpack_public_path__ is a global variable that can be used to adjust
|
|
|
|
// the webpack publicPath setting at runtime.
|
|
|
|
// see: https://webpack.js.org/guides/public-path/
|
|
|
|
const relativeRootPath = (gon && gon.relative_url_root) || '';
|
2019-04-30 16:32:11 +00:00
|
|
|
const webpackAssetPath = joinPaths(relativeRootPath, '/assets/webpack/');
|
2020-02-03 09:08:42 +00:00
|
|
|
__webpack_public_path__ = webpackAssetPath; // eslint-disable-line babel/camelcase
|
2019-02-08 14:06:24 +00:00
|
|
|
}
|