summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2019-02-08 15:08:48 +0000
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-02-11 14:03:25 +0000
commit6942aa5f1a497d84be8ebc82b7482911953a9b9c (patch)
tree5ba1c69d16ea9672e8792d2814ebbecb76d070c4
parent4adfa518537b6e70701fc24281f9f8e1f92c6266 (diff)
downloadgitlab-ce-6942aa5f1a497d84be8ebc82b7482911953a9b9c.tar.gz
Merge branch 'mr-web-worker-origin' into 'master'
Fixes diff web worker not loading in staging See merge request gitlab-org/gitlab-ce!25039 (cherry picked from commit 171d919c19693c12e36dc6485c40a8abaf594e88) 37b860d7 Fixes diff web worker not loading in staging
-rw-r--r--app/assets/javascripts/ide/index.js11
-rw-r--r--app/assets/javascripts/lib/utils/webpack.js10
-rw-r--r--app/assets/javascripts/mr_notes/index.js3
3 files changed, 14 insertions, 10 deletions
diff --git a/app/assets/javascripts/ide/index.js b/app/assets/javascripts/ide/index.js
index 5a2b680c2f7..cdfebd19fa4 100644
--- a/app/assets/javascripts/ide/index.js
+++ b/app/assets/javascripts/ide/index.js
@@ -6,6 +6,7 @@ import ide from './components/ide.vue';
import store from './stores';
import router from './ide_router';
import { parseBoolean } from '../lib/utils/common_utils';
+import { resetServiceWorkersPublicPath } from '../lib/utils/webpack';
Vue.use(Translate);
@@ -60,16 +61,6 @@ export function initIde(el, options = {}) {
});
}
-// tell webpack to load assets from origin so that web workers don't break
-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) || '';
- const webpackAssetPath = `${relativeRootPath}/assets/webpack/`;
- __webpack_public_path__ = webpackAssetPath; // eslint-disable-line camelcase
-}
-
/**
* Start the IDE.
*
diff --git a/app/assets/javascripts/lib/utils/webpack.js b/app/assets/javascripts/lib/utils/webpack.js
new file mode 100644
index 00000000000..308ad9784e4
--- /dev/null
+++ b/app/assets/javascripts/lib/utils/webpack.js
@@ -0,0 +1,10 @@
+// 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() {
+ // __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) || '';
+ const webpackAssetPath = `${relativeRootPath}/assets/webpack/`;
+ __webpack_public_path__ = webpackAssetPath; // eslint-disable-line camelcase
+}
diff --git a/app/assets/javascripts/mr_notes/index.js b/app/assets/javascripts/mr_notes/index.js
index e4d72eb8318..9e99aa4f724 100644
--- a/app/assets/javascripts/mr_notes/index.js
+++ b/app/assets/javascripts/mr_notes/index.js
@@ -7,8 +7,11 @@ import discussionCounter from '../notes/components/discussion_counter.vue';
import initDiscussionFilters from '../notes/discussion_filters';
import store from './stores';
import MergeRequest from '../merge_request';
+import { resetServiceWorkersPublicPath } from '../lib/utils/webpack';
export default function initMrNotes() {
+ resetServiceWorkersPublicPath();
+
const mrShowNode = document.querySelector('.merge-request');
// eslint-disable-next-line no-new
new MergeRequest({