Open YellowPure opened 3 years ago
commonChunks不是可以自己配置吗?
目前我项目中
cacheGroups: {
common: {
name: 'common',
minChunks: 2,
priority: 1
},
vendors2: {
name: 'vendors2',
test: /[\\/]node_modules[\\/](taro-ui|crypto-es|)[\\/]/,
priority: 20,
enforce: true,
reuseExistingChunk: true
},
vendors3: {
name: 'vendors3',
test: /[\\/]node_modules[\\/](mobx|mobx-react|mobx-react-lite|elliptic|
react-reconciler|browserify-sign|browserify-rsa|)[\\/]/,
priority: 20,
enforce: true,
reuseExistingChunk: true
},
vendors: {
name: 'vendors',
minChunks: 2,
test: module => {
return /[\\/]node_modules[\\/]/.test(module.resource);
},
// maxSize: 900000,
priority: 10
},
taro: {
name: 'taro',
test: module => {
return taroBaseReg.test(module.context);
},
priority: 100
}
}
commonChunks: commonChunks => {
console.log('commonChunks', commonChunks);
commonChunks.push('vendors2', 'vendors3');
return commonChunks;
}
这样手动去设置chunk,我希望能通过cacheGroup时能通过maxSize分包,此时commonchunks
应该是不固定的吧?请问有方案可以满足此场景吗
dengqing ***@***.***> 于2021年7月14日周三 下午8:00写道:
> commonChunks不是可以自己配置吗?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/NervJS/taro/issues/9573#issuecomment-879831186>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABN2XRT7CB6GTLIOX4UX243TXV37LANCNFSM47AU5JNQ>
> .
>
动态的好像不行,把react、taro、mobx 主要几个大库拆出来应该不会大于500k了吧
对,但是需要手动拆包,没法用maxSize这样 相当于开发者要手动控制 我看taro好像在迭代这块
dengqing @.***> 于2021年7月15日周四 上午9:47写道:
动态的好像不行,把react、taro、mobx 主要几个大库拆出来应该不会大于500k了吧
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NervJS/taro/issues/9573#issuecomment-880324966, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABN2XRSNC5RV6MRPZCHGEG3TXY423ANCNFSM47AU5JNQ .
相关平台
微信小程序
小程序基础库: 2.17.0 使用框架: React
复现步骤
开启开发者工具的es6转es5,当vendors体积大于500kb时,window桌面版小程序报错
期望结果
可自定义commonchunks 的name,希望由splitchunks中具体的chunksName生成
实际结果
目前commonChunks Name为代码中defaultCommonChunks 静态变量而来,无法和splitchunks中Name匹配
环境信息