(精华)2020年7月12日 webpack 代码分割和多线程打包
        【摘要】 
                    
                        
                    
                    optimization: {
  splitChunks: {
    chunks: 'async', //对同步,异步,所有的模块有效 
    minSize: 30000, //当模块大于 30...
    
    
    
    optimization: {
  splitChunks: {
    chunks: 'async', //对同步,异步,所有的模块有效 
    minSize: 30000, //当模块大于 30kb 
    maxSize: 0, //对模块进行二次分割时使用,不推荐使用 
    minChunks: 1, //打包生成的 chunk 文件最少有几个 chunk 引用了这个模块 
    maxAsyncRequests: 5, //模块请求 5 次 
    maxInitialRequests: 3, //入口文件同步请求 3 次 
    automaticNameDelimiter: '~',
    name: true,
    cacheGroups: {
      vendors: {
        test: /[\\/]node_modules[\\/]/,
        priority: -10 ,//优先级 数字越大,优先级越高 
        default: {
          minChunks: 2,
          priority: -20,
          reuseExistingChunk: true
        }
      }
    }
  },
  minimize: true,
  minimizer: [
    new TerserPlugin({
      cache: true, // 是否缓存
      parallel: 4 // 是否并行打包,多线程 // parallel: 4,
    }),
  ],
},
  
 - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 
文章来源: codeboy.blog.csdn.net,作者:愚公搬代码,版权归原作者所有,如需转载,请联系作者。
原文链接:codeboy.blog.csdn.net/article/details/107301937
        【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
            cloudbbs@huaweicloud.com
        
        
        
        
        
        
        - 点赞
 - 收藏
 - 关注作者
 
            
           
评论(0)