Extract the public dependency module to existing entrance CHUNK, or extract a newly generated chunk

The official document uses a plug-in:

new webpack.optimize.CommonsChunkPlugin({  name:'common' // Specify the name of the common bundle.  })
but an error: webpack .optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead
webpack4 does not have this plugin configuration, it should be generated by configuration:
Add the following configuration at the same level of entry:
optimization: {
splitChunks: {
CacheGroups: {
Commons: {
Name: “commons”,
Chunks: “initial”,
MinSize: 1

div> div>

}
}

optimization: {

splitChunks: {

CacheGroups: {

Commons: {