【发布时间】:2018-11-17 18:51:19
【问题描述】:
我正在尝试将我的构建文件拆分到我的webpack.config.js 文件中,但我的vendors 文件根本没有被创建。其余的node_modules,不是react 或moment 文件最终在main.js 中。 main.js 中的文件示例是 ./node_modules/es-abstract。我将我的正则表达式和文件名放入正则表达式检查器中,它通过了测试。我不确定发生了什么;任何帮助将不胜感激。
splitChunks: {
cacheGroups: {
moment: {
test: /[\\/]node_modules[\\/]((moment).*)[\\/]/,
name: 'moment',
chunks: 'all'
},
react: {
test: /[\\/]node_modules[\\/]((react).*)[\\/]/,
name: 'react',
chunks: 'all'
},
vendors: {
test: /[\\/]node_modules[\\/]((?!(moment|react)).*)[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
【问题讨论】:
标签: regex reactjs webpack webpack-splitchunks splitchunksplugin