|
@@ -29,45 +29,47 @@ module.exports = defineConfig({
|
|
|
config
|
|
|
.optimization.splitChunks({
|
|
|
chunks: 'all',
|
|
|
- cacheGroups: {
|
|
|
- libs: {
|
|
|
- name: 'chunk-libs',
|
|
|
- test: /[\\/]node_modules[\\/]/,
|
|
|
- priority: 10,
|
|
|
- chunks: 'initial'
|
|
|
- },
|
|
|
- elementUI: {
|
|
|
- name: 'chunk-elementUI',
|
|
|
- priority: 20,
|
|
|
- test: /[\\/]node_modules[\\/]_?element-plus(.*)/,
|
|
|
- chunks: 'initial'
|
|
|
- },
|
|
|
- echarts: {
|
|
|
- name: 'chunk-echarts',
|
|
|
- priority: 20,
|
|
|
- test: /[\\/]node_modules[\\/]_?echarts(.*)/,
|
|
|
- },
|
|
|
- flv: {
|
|
|
- name: 'chunk-flv',
|
|
|
- priority: 20,
|
|
|
- test: /[\\/]node_modules[\\/]_?flv(.*)/
|
|
|
- },
|
|
|
- jsJquery: {
|
|
|
- name: 'chunk-jquery',
|
|
|
- priority: 20,
|
|
|
- test: /[\\/]node_modules[\\/]_?jquery(.*)/
|
|
|
- },
|
|
|
- mqtt: {
|
|
|
- name: 'chunk-mqtt',
|
|
|
- priority: 20,
|
|
|
- test: /[\\/]node_modules[\\/]_?mqtt(.*)/
|
|
|
- },
|
|
|
- mqttPacket: {
|
|
|
- name: 'chunk-mqtt-packet',
|
|
|
- priority: 20,
|
|
|
- test: /[\\/]node_modules[\\/]_?mqtt-packet(.*)/
|
|
|
- },
|
|
|
- }
|
|
|
+ minSize: 50000, //构建出来的chunk大于30000才会被分割
|
|
|
+ maxSize: 100000, //会尝试根据这个大小进行代码分割
|
|
|
+ // cacheGroups: {
|
|
|
+ // libs: {
|
|
|
+ // name: 'chunk-libs',
|
|
|
+ // test: /[\\/]node_modules[\\/]/,
|
|
|
+ // priority: 10,
|
|
|
+ // chunks: 'initial'
|
|
|
+ // },
|
|
|
+ // elementUI: {
|
|
|
+ // name: 'chunk-elementUI',
|
|
|
+ // priority: 20,
|
|
|
+ // test: /[\\/]node_modules[\\/]_?element-plus(.*)/,
|
|
|
+ // chunks: 'initial'
|
|
|
+ // },
|
|
|
+ // echarts: {
|
|
|
+ // name: 'chunk-echarts',
|
|
|
+ // priority: 20,
|
|
|
+ // test: /[\\/]node_modules[\\/]_?echarts(.*)/,
|
|
|
+ // },
|
|
|
+ // flv: {
|
|
|
+ // name: 'chunk-flv',
|
|
|
+ // priority: 20,
|
|
|
+ // test: /[\\/]node_modules[\\/]_?flv(.*)/
|
|
|
+ // },
|
|
|
+ // jsJquery: {
|
|
|
+ // name: 'chunk-jquery',
|
|
|
+ // priority: 20,
|
|
|
+ // test: /[\\/]node_modules[\\/]_?jquery(.*)/
|
|
|
+ // },
|
|
|
+ // mqtt: {
|
|
|
+ // name: 'chunk-mqtt',
|
|
|
+ // priority: 20,
|
|
|
+ // test: /[\\/]node_modules[\\/]_?mqtt(.*)/
|
|
|
+ // },
|
|
|
+ // mqttPacket: {
|
|
|
+ // name: 'chunk-mqtt-packet',
|
|
|
+ // priority: 20,
|
|
|
+ // test: /[\\/]node_modules[\\/]_?mqtt-packet(.*)/
|
|
|
+ // },
|
|
|
+ // }
|
|
|
})
|
|
|
}
|
|
|
)
|