chunks.some 不是函数
chunks.some is not a function
我刚刚从 webpack 4 升级到 webpack 5,但现在当我尝试构建我的解决方案时,它抛出了以下错误:
TypeError: chunks.some is not a function
这是我 webpack.config 中的行:
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
name: 'vendor',
chunks: 'all',
reuseExistingChunk: true,
priority: 100,
enforce: true,
test(module, chunks) {
const name = module.nameForCondition && module.nameForCondition();
return chunks.some(chunk => {
return (/[\/]node_modules[\/]/.test(name)
|| /[\/]vendor[\/]/.test(name));
});
}
},
有谁知道这已被替换为什么或者我如何更改上面的内容才能正常工作?
我设法使用以下方法修复它:
splitChunks: {
cacheGroups: {
vendor: {
name: 'vendor',
chunks: 'all',
reuseExistingChunk: true,
priority: 100,
enforce: true,
test: /[\/]node_modules[\/]|vendor[\/]/,
},
},
},
我刚刚从 webpack 4 升级到 webpack 5,但现在当我尝试构建我的解决方案时,它抛出了以下错误:
TypeError: chunks.some is not a function
这是我 webpack.config 中的行:
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
name: 'vendor',
chunks: 'all',
reuseExistingChunk: true,
priority: 100,
enforce: true,
test(module, chunks) {
const name = module.nameForCondition && module.nameForCondition();
return chunks.some(chunk => {
return (/[\/]node_modules[\/]/.test(name)
|| /[\/]vendor[\/]/.test(name));
});
}
},
有谁知道这已被替换为什么或者我如何更改上面的内容才能正常工作?
我设法使用以下方法修复它:
splitChunks: {
cacheGroups: {
vendor: {
name: 'vendor',
chunks: 'all',
reuseExistingChunk: true,
priority: 100,
enforce: true,
test: /[\/]node_modules[\/]|vendor[\/]/,
},
},
},