Commit 5b43aa95 authored by Mike Greiling's avatar Mike Greiling

move webpack publicPath setup earlier in the bootstrap processes to avoid ES...

move webpack publicPath setup earlier in the bootstrap processes to avoid ES module execution order issues
parent 8bb20132
...@@ -164,14 +164,6 @@ import './visibility_select'; ...@@ -164,14 +164,6 @@ import './visibility_select';
import './wikis'; import './wikis';
import './zen_mode'; import './zen_mode';
// set url root for webpack async chunks (assumes config.output.publicPath is an absolute path)
if (gon && gon.relative_url_root) {
const basePath = gon.relative_url_root.replace(/\/$/, '');
// eslint-disable-next-line camelcase, no-undef
__webpack_public_path__ = basePath + __webpack_public_path__;
}
// eslint-disable-next-line global-require, import/no-commonjs // eslint-disable-next-line global-require, import/no-commonjs
if (process.env.NODE_ENV !== 'production') require('./test_utils/'); if (process.env.NODE_ENV !== 'production') require('./test_utils/');
......
/**
* 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 settings which cannot be baked-in
* to our webpack bundles.
*/
if (gon && gon.relative_url_root) {
// this assumes config.output.publicPath is an absolute path
const basePath = gon.relative_url_root.replace(/\/$/, '');
// eslint-disable-next-line camelcase, no-undef
__webpack_public_path__ = basePath + __webpack_public_path__;
}
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
= Gon::Base.render_data = Gon::Base.render_data
= webpack_bundle_tag "runtime" = webpack_bundle_tag "webpack_runtime"
= webpack_bundle_tag "common" = webpack_bundle_tag "common"
= webpack_bundle_tag "locale" = webpack_bundle_tag "locale"
= webpack_bundle_tag "main" = webpack_bundle_tag "main"
......
...@@ -71,6 +71,7 @@ var config = { ...@@ -71,6 +71,7 @@ var config = {
vue_merge_request_widget: './vue_merge_request_widget/index.js', vue_merge_request_widget: './vue_merge_request_widget/index.js',
test: './test.js', test: './test.js',
peek: './peek.js', peek: './peek.js',
webpack_runtime: './webpack.js',
}, },
output: { output: {
...@@ -189,7 +190,7 @@ var config = { ...@@ -189,7 +190,7 @@ var config = {
// create cacheable common library bundles // create cacheable common library bundles
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
names: ['main', 'locale', 'common', 'runtime'], names: ['main', 'locale', 'common', 'webpack_runtime'],
}), }),
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment