Merge pull request #2687 from NicoPennec/dev

feat: optional build option to limit chunks size
This commit is contained in:
Sébastien Chopin 2018-01-26 12:21:47 +01:00 committed by GitHub
commit 6d71770bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -7,7 +7,8 @@ module.exports = {
]
},
build: {
vendor: ['axios', 'moment', 'chart.js', 'vue-chartjs']
vendor: ['axios', 'moment', 'chart.js', 'vue-chartjs'],
maxChunkSize: 300000
},
env: {
githubToken: '42cdf9fd55abf41d24f34c0f8a4d9ada5f9e9b93'

View File

@ -166,6 +166,17 @@ module.exports = function webpackClientConfig() {
config.plugins.push(new webpack.optimize.ModuleConcatenationPlugin())
}
// Chunks size limit
// https://webpack.js.org/plugins/aggressive-splitting-plugin/
if (this.options.build.maxChunkSize) {
config.plugins.push(
new webpack.optimize.AggressiveSplittingPlugin({
minSize: this.options.build.maxChunkSize,
maxSize: this.options.build.maxChunkSize
})
)
}
// https://webpack.js.org/plugins/hashed-module-ids-plugin
config.plugins.push(new webpack.HashedModuleIdsPlugin())

View File

@ -184,6 +184,7 @@ Options.defaults = {
profile: process.argv.includes('--profile'),
dll: false,
scopeHoisting: false,
maxChunkSize: false,
extractCSS: false,
cssSourceMap: undefined,
ssr: undefined,