webpack SplitChunksPlugin 配置参数

//https://www.webpackjs.com/plugins/split-chunks-plugin/
// 代码分割
splitChunks: { chunks: "all", // async: 打包异步引入的代码块 all: 同步、异步 initial: 同步代码 minSize: 30000, // 字节 超出30kb的代码块 minChunks: 1, // 模块被使用次数 maxAsyncRequests: 5, // 同时加载的模块数 最多打包出的个数 maxInitialRequests: 3, // 首页 或 入口处 automaticNameDelimiter: '~', // name: true, cacheGroups: { // 缓存组 vendors: { // vendors: false 打包的文件名不再添加vendors test: /[\\/]node_modules[\\/]/, // 匹配规则 priority: -10, // 优先级
       filename: 'vendors.js' },   default: { // default: false minChunks: 2, priority: -20, reuseExistingChunk: true, // 一个模块被打包过,不会重复打包
       filename: 'common.js' } } }

  

posted @ 2019-05-30 15:45  ·悟空·  阅读(507)  评论(0编辑  收藏  举报