我处于一种独特的情况,我需要将我的捆绑包分成单独的文件,但我没有奢侈的文件总数或这些文件的名称随着应用程序的增长和新的变化而变化已安装依赖项等。
以下配置是错误的,但我认为它最能说明我想要完成的工作。我已经阅读了所有文档,但似乎找不到任何内容。
optimization: {
splitChunks: {
react: {
test: /node_modules\/react/
},
vendor: {
test: /node_modules\/(?!react)/
},
svgIcons: {
test: /src\/js\/components\/icons/
},
}
}
目的是我们最终会得到以下 4 个捆绑包:
react.bundle.js - Contains all react-related dependencies
vendor.bundle.js - Contains all other vendor files from node modules
svgIcons.bundle.js - Contains a group of app component files that match my test
bundle.js - The default bundle containing everything else.
有没有办法做到这一点?