webpack4的生产模式公共代码提取只能提取两个模块怎么办

新手上路,请多包涵

以下是我的提取配置,我想把jquery,lodash,reactDom,
react,reactRedux提取为单独的js,开发模式这样是没问题的,但是切换到生产模式mode: 'production',就只能提取两个,其他的不生效,例如我打包只能提取jquery和lodash,如果把jquery和lodash的提取注释掉,就只能提取reactDom和reactRedux。。。

optimization: {  
    splitChunks: {  
        minSize: 30000,  
  cacheGroups: {  
            jquery: {  
                test: /\\/node\_modules\\/\_jquery@3.4.1@jquery\\//,  
  name: 'jquery',  
  chunks: 'all',  
  priority: 10,  
  minSize: 1  
  },  
  lodash: {  
                test: /\\/node\_modules\\/\_lodash@4.17.15@lodash\\//,  
  name: 'lodash',  
  chunks: 'all',  
  priority: 9,  
  minSize: 1  
  },  
  reactDom: {  
                test: /\\/node\_modules\\/\_react-dom@16.12.0@react-dom\\//,  
  name: 'reactDom',  
  chunks: 'all',  
  priority: 8,  
  minSize: 1  
  },  
  reactRedux: {  
                test: /\\/node\_modules\\/\_react-redux@5.1.2@react-redux\\//,  
  name: 'reactRedux',  
  chunks: 'all',  
  priority: 7,  
  minSize: 1  
  },  
  react: {  
                test: /\\/node\_modules\\/\_react@16.12.0@react\\//,  
  name: 'react',  
  chunks: 'all',  
  priority: 6,  
  minSize: 1  
  }  
        }  
    }  
}
阅读 1.2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题