以下是我的提取配置,我想把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
}
}
}
}