diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-03-04 23:51:37 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-03-20 15:29:45 -0500 |
commit | 7e715cbfc8012ce78021c218a1f55b5d3827261b (patch) | |
tree | 6150728e94b4bee075cd721be2bff1ef5b4ac9b5 | |
parent | 4d80d92585f4c866e84e52d2b17947ff8279f478 (diff) | |
download | gitlab-ce-7e715cbfc8012ce78021c218a1f55b5d3827261b.tar.gz |
update config
-rw-r--r-- | config/webpack.config.js | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js index b15727c2816..2be1f8fb56a 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -23,6 +23,7 @@ const NO_COMPRESSION = process.env.NO_COMPRESSION; let autoEntriesCount = 0; let watchAutoEntries = []; +const defaultEntries = ['./webpack', './commons', './main']; function generateEntries() { // generate automatic entry points @@ -35,8 +36,7 @@ function generateEntries() { function generateAutoEntries(path, prefix = '.') { const chunkPath = path.replace(/\/index\.js$/, ''); const chunkName = chunkPath.replace(/\//g, '.'); - // console.log(`${chunkName} => ${chunkPath}`); - autoEntries[chunkName] = ['./webpack', './commons', './main', `${prefix}/${path}`]; + autoEntries[chunkName] = defaultEntries.concat(`${prefix}/${path}`); } pageEntries.forEach(( path ) => generateAutoEntries(path)); @@ -70,22 +70,21 @@ const config = { optimization: { splitChunks: { chunks: 'all', - minSize: 10000, - minChunks: 1, - maxAsyncRequests: 5, - maxInitialRequests: 4, + maxInitialRequests: 5, cacheGroups: { - vendors: { - priority: 10, - minSize: 100000, - test: /[\\/](node_modules|vendor[\\/]assets[\\/]javascripts)[\\/]/, - }, main: () => ({ + priority: 10, name: 'main', chunks: 'initial', - priority: 0, minChunks: autoEntriesCount * 0.9, }), + common_vendors: { + priority: 20, + name: 'common-vendors', + chunks: 'initial', + minChunks: 30, + test: /[\\/](node_modules|vendor[\\/]assets[\\/]javascripts)[\\/]/, + }, }, }, }, @@ -279,20 +278,20 @@ const config = { }; if (IS_PRODUCTION) { - config.devtool = 'source-map'; - config.plugins.push( - new webpack.NoEmitOnErrorsPlugin(), - new webpack.LoaderOptionsPlugin({ - minimize: true, - debug: false - }), - new webpack.optimize.UglifyJsPlugin({ - sourceMap: true - }), - new webpack.DefinePlugin({ - 'process.env': { NODE_ENV: JSON.stringify('production') } - }) - ); + // config.devtool = 'source-map'; + // config.plugins.push( + // new webpack.NoEmitOnErrorsPlugin(), + // new webpack.LoaderOptionsPlugin({ + // minimize: true, + // debug: false + // }), + // new webpack.optimize.UglifyJsPlugin({ + // sourceMap: true + // }), + // new webpack.DefinePlugin({ + // 'process.env': { NODE_ENV: JSON.stringify('production') } + // }) + // ); // compression can require a lot of compute time and is disabled in CI if (!NO_COMPRESSION) { |