提交 5b43aa95 编写于 作者: M 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
上级 8bb20132
......@@ -164,14 +164,6 @@ import './visibility_select';
import './wikis';
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
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 @@
= Gon::Base.render_data
= webpack_bundle_tag "runtime"
= webpack_bundle_tag "webpack_runtime"
= webpack_bundle_tag "common"
= webpack_bundle_tag "locale"
= webpack_bundle_tag "main"
......
......@@ -71,6 +71,7 @@ var config = {
vue_merge_request_widget: './vue_merge_request_widget/index.js',
test: './test.js',
peek: './peek.js',
webpack_runtime: './webpack.js',
},
output: {
......@@ -189,7 +190,7 @@ var config = {
// create cacheable common library bundles
new webpack.optimize.CommonsChunkPlugin({
names: ['main', 'locale', 'common', 'runtime'],
names: ['main', 'locale', 'common', 'webpack_runtime'],
}),
],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册