小程序拆分公共文件报错
-
vendor文件太大了,想要拆分组件,按照文档写的代码,提示this.commonChunks.includes is not a function,麻烦大佬看下怎么解决
代码:
mini: { webpackChain (chain, webpack) { chain.merge({ optimization: { splitChunks: { cacheGroups: { lodash: { name: 'lodash', priority: 1000, test (module) { return /node_modules[\\/]lodash/.test(module.context) } } } } } }) }, commonChunks (commonChunks) { commonChunks.push('lodash') return commonChunks } },
报错提示
/Users/Documents/gym-tim/node_modules/@tarojs/mini-runner/dist/plugins/TaroLoadChunksPlugin.js:19 commonChunks = chunks.filter(chunk => this.commonChunks.includes(chunk.name)).reverse(); this.commonChunks.includes is not a function