title: Unable to migrate from CommonsChunkPlugin to Webpack 4 optimization.splitChunks
body: <p>I'm unable to figure out how to migrate my existing webpack 3 CommonsChunkPlugin to the new webpack 4 optimization.splitChunks.</p>
  
  <p>My existing configuration can be distilled to the following:</p>
  
  <pre><code>module.exports = function (env) {
      const entry = {
          common: ['libA', 'libB', './common/A.js', './common/A.js', /* ... */],
          pageA: ['./src/pageA/file1.js', './src/pageA/file2.js', /* ... */],
          pageB: ['./src/pageB/file1.js', './src/pageB/file2.js', /* ... */],
          /* ... */
      };
  
      return {
          entry,
          output: {
              path: path.resolve('./dist'),
              filename: `[name]${env.mode === 'production' ? '.min' : ''}.js`,
              chunkFilename: `[name]${env.mode === 'production' ? '.min' : ''}.js`
          },
          module: {
              /* ... */
          },
          plugins: [
              new webpack.optimize.CommonsChunkPlugin({
                  name: 'common',
                  filename: `[name]${env.mode === 'production' ? '.min' : ''}.js`,
                  chunks: Object.keys(entry),
                  minChunks: 10
              })
          ]
      };
  };
  </code></pre>
  
  <p>This generates a single common chunk named <code>common.min.js</code> that contains (at least) all files specified in the <code>common</code> entry and additionally adds all files that are used in at least 10 entries.</p>
  
  <p>How would I do this in webpack 4 using <code>optimization.splitChunks</code>?</p>