从webpack3 到webpack4 踩坑记录

1.

这句话的意思是,CommonsChunkPlugin已经移除,请用splitChunks,

修改成以下:

  new webpack.optimize.SplitChunksPlugin({
            cacheGroups: {
                default: {
                    minChunks: 2,
                    reuseExistingChunk: true,
                },
                //打包重复出现的代码
                vendor: {
                    chunks: 'initial',
                    minChunks: 2,
                    name: 'vendor'
                },
                //打包第三方类库
                commons: {
                    name: "commons",
                    chunks: "initial",
                    minChunks: Infinity
                }
            }
        }),

2.

 持续更新。特此记录

你可能感兴趣的:(Webpack4)