Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Commit

Permalink
Merge pull request #412 from saguijs/set-minchunks-value-in-the-commo…
Browse files Browse the repository at this point in the history
…n-chunks-plugin-config

Set minChunks to 2 by default in CommonChunksPlugin
  • Loading branch information
pirelenito authored Nov 8, 2017
2 parents 19ff8e7 + ffd0864 commit ebc2d85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/configure-webpack/build-pages-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function configurePlugins (pages, action) {
})

if (pages.length > 1) {
plugins.push(new optimize.CommonsChunkPlugin({ name: 'common' }))
plugins.push(new optimize.CommonsChunkPlugin({ name: 'common', minChunks: 2 }))
}

return plugins
Expand Down
7 changes: 7 additions & 0 deletions src/configure-webpack/build-pages-config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ describe('pages webpack preset', function () {
const commons = webpackConfig.plugins.filter((plugin) => plugin instanceof optimize.CommonsChunkPlugin)
expect(commons.length).equal(1)
})

it('should set minChunks to 2 in the CommonsChunkPlugin', function () {
const webpackConfig = buildPagesConfig(['index', 'demo'], baseConfig)

const commons = webpackConfig.plugins.filter((plugin) => plugin instanceof optimize.CommonsChunkPlugin)
expect(commons[0].minChunks).equal(2)
})
})

describe(`when action is "${actions.BUILD}"`, () => {
Expand Down

0 comments on commit ebc2d85

Please sign in to comment.