diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2018-05-07 22:46:42 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2018-05-07 22:46:42 +0300 |
commit | 797a080681233e97ccc0c9ba72431e4b450fff7b (patch) | |
tree | 4bbfcc9c05c033e28c5b8126a09489982b5b1603 /app/assets/javascripts/ide/index.js | |
parent | ec970e8a3f060986d4e2c0da724c15f6b34587d7 (diff) | |
parent | caf49264b47999a5b888a3ada3b70cc76e94d2bd (diff) |
Merge branch 'upgrade-to-webpack-v4' into 'master'
Upgrade to Webpack 4
Closes #43400
See merge request gitlab-org/gitlab-ce!17218
Diffstat (limited to 'app/assets/javascripts/ide/index.js')
-rw-r--r-- | app/assets/javascripts/ide/index.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/app/assets/javascripts/ide/index.js b/app/assets/javascripts/ide/index.js index e5c47d09886..c5835cd3b06 100644 --- a/app/assets/javascripts/ide/index.js +++ b/app/assets/javascripts/ide/index.js @@ -4,7 +4,9 @@ import ide from './components/ide.vue'; import store from './stores'; import router from './ide_router'; -function initIde(el) { +Vue.use(Translate); + +export function initIde(el) { if (!el) return null; return new Vue({ @@ -27,8 +29,12 @@ function initIde(el) { }); } -const ideElement = document.getElementById('ide'); - -Vue.use(Translate); - -initIde(ideElement); +// 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 +} |