diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-05-25 02:51:36 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-05-25 12:51:11 -0500 |
commit | 5270edb701d4f614dbba68d5a90be0682b252002 (patch) | |
tree | 7c81e52a34c553dfd135a7ca72e46bef45f7466e /config | |
parent | 5c0f506deb3fb6910714e0441efe6bfcfc29f4ad (diff) | |
download | gitlab-ce-5270edb701d4f614dbba68d5a90be0682b252002.tar.gz |
name all webpack chunks to improve long term cacheability
Diffstat (limited to 'config')
-rw-r--r-- | config/webpack.config.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js index c26f3b5063f..2ada74e5a55 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -70,7 +70,8 @@ var config = { output: { path: path.join(ROOT_PATH, 'public/assets/webpack'), publicPath: '/assets/webpack/', - filename: IS_PRODUCTION ? '[name].[chunkhash].bundle.js' : '[name].bundle.js' + filename: IS_PRODUCTION ? '[name].[chunkhash].bundle.js' : '[name].bundle.js', + chunkFilename: IS_PRODUCTION ? '[name].[chunkhash].chunk.js' : '[name].chunk.js', }, devtool: 'cheap-module-source-map', @@ -131,6 +132,17 @@ var config = { new webpack.NamedModulesPlugin(), new NameAllModulesPlugin(), + // assign deterministic chunk ids + new webpack.NamedChunksPlugin((chunk) => { + if (chunk.name) { + return chunk.name; + } + return chunk.modules.map((m) => { + var chunkPath = m.request.split('!').pop(); + return path.relative(m.context, chunkPath); + }).join('_'); + }), + // create cacheable common library bundle for all vue chunks new webpack.optimize.CommonsChunkPlugin({ name: 'common_vue', |