We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack的chunks是通过webpack内部的一个插件来实现的,在3版本及以前使用的是CommonsChunkPlugin;在4版本后开始使用SplitChunksPlugin,我们对于3版本及以前的不做解释,着眼未来,我们来看SplitChunksPlugin;我们根据配置来看:
module.exports = { optimization: { splitChunks: { chunks: 'async', minSize: 30000, minChunks: 1, maxAsyncRequests: 5, maxInitialRequests: 3, automaticNameDelimiter: '~', name: true, cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, priority: -10 }, default: { minChunks: 2, priority: -20, reuseExistingChunk: true } } } } };
上面是webpack的默认配置,splitChunks就算你什么配置都不做它也是生效的,源于webpack有一个默认配置,这也符合webpack4的开箱即用的特性。
chunks意思为拆分模块的范围,有三个值:async、all和initial;三个值的区别如下:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
webpack的chunks是通过webpack内部的一个插件来实现的,在3版本及以前使用的是CommonsChunkPlugin;在4版本后开始使用SplitChunksPlugin,我们对于3版本及以前的不做解释,着眼未来,我们来看SplitChunksPlugin;我们根据配置来看:
上面是webpack的默认配置,splitChunks就算你什么配置都不做它也是生效的,源于webpack有一个默认配置,这也符合webpack4的开箱即用的特性。
chunks意思为拆分模块的范围,有三个值:async、all和initial;三个值的区别如下:
上面还有几个参数:
注意:
The text was updated successfully, but these errors were encountered: