How to configure CommonsChunkPlugin when configuring multiple file caches in webpack4?

is currently nibbling on the webpack introductory tutorial. However, the download is webpack4 . It is said that it is quite different from the current mainstream webpack3 , such as ides/caching/" rel=" nofollow noreferrer "Caching , in which there is an example:

.
+     new webpack.optimize.CommonsChunkPlugin({
+       name: "vendor"
+     }),
      new webpack.optimize.CommonsChunkPlugin({
        name: "manifest"
      })

I know how to configure it alone, but when I have more than one, I don"t know how to do it.

optimization: {
  splitChunks: {
      name: "manifest"
    }
  },
There are also a lot of questions on

sokra/RIP CommonsChunkPlugin.md .

Thank you.

Mar.18,2021

cacheGroups


read an introduction article, CommonsChunkPlugin will be removed in version 4.0

https://zhuanlan.zhihu.com/p/.

at present, webpack documents are seriously out of date, and foreigners are also dissatisfied with

.

https://www.reddit.com/r/java.


The CommonsChunkPlugin has been removed in webpack v4 legato. To learn how chunks are treated in the latest version, check out the SplitChunksPlugin.


// webpack.config.js
optimization: {
  splitChunks: {
    cacheGroups: {
      commons: {
        name: 'commons',
        priority: 10,
        chunks: 'initial'
      },
      styles: {
        name: 'styles',
        test: /\.css$/,
        chunks: 'all',
        minChunks: 2,
        enforce: true
      }
    }
  }
}

https://codeshelper.com/a/11.


the official website has already stated:

it's better to read the latest documents on the official website: ides/code-splitting/-sharpentry-points" rel=" nofollow noreferrer "> https://webpack.js.org/guides.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea81ff-1ead.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea81ff-1ead.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?