2024-06-07 15:26:58 +08:00
|
|
|
import pkg from '../package.json'
|
|
|
|
import viteCompression from 'vite-plugin-compression'
|
2024-09-23 17:31:59 +08:00
|
|
|
|
2024-06-07 15:26:58 +08:00
|
|
|
export default {
|
|
|
|
plugins: [
|
|
|
|
viteCompression({
|
|
|
|
// gzip静态资源压缩配置
|
|
|
|
verbose: true, // 是否在控制台输出压缩结果
|
|
|
|
disable: false, // 是否禁用压缩
|
|
|
|
threshold: 10240, // 启用压缩的文件大小限制
|
|
|
|
algorithm: 'gzip', // 采用的压缩算法
|
|
|
|
ext: '.gz' // 生成的压缩包后缀
|
|
|
|
})
|
|
|
|
],
|
|
|
|
build: {
|
2024-09-23 17:31:59 +08:00
|
|
|
cssCodeSplit: false,
|
2024-06-07 15:26:58 +08:00
|
|
|
rollupOptions: {
|
2024-06-20 16:32:02 +08:00
|
|
|
external: id => /de-xpack/.test(id) || /extensions/.test(id),
|
2024-06-07 15:26:58 +08:00
|
|
|
output: {
|
|
|
|
// 用于命名代码拆分时创建的共享块的输出命名
|
|
|
|
chunkFileNames: `assets/chunk/[name]-${pkg.version}-${pkg.name}.js`,
|
|
|
|
assetFileNames: `assets/[ext]/[name]-${pkg.version}-${pkg.name}.[ext]`,
|
|
|
|
entryFileNames: `js/[name]-${pkg.version}-${pkg.name}.js`,
|
2024-09-23 17:31:59 +08:00
|
|
|
manualChunks: {
|
|
|
|
echarts: ['echarts'],
|
|
|
|
vue: ['vue', 'vue-router', 'pinia', 'vue-i18n', 'mitt'],
|
|
|
|
lodash: ['lodash-es', 'lodash'],
|
|
|
|
library: ['jspdf', '@tinymce/tinymce-vue', 'screenfull'],
|
|
|
|
antv: ['@antv/g2', '@antv/g2plot', '@antv/l7', '@antv/l7plot', '@antv/s2'],
|
|
|
|
tinymce: ['tinymce'],
|
|
|
|
axios: ['axios'],
|
2024-09-24 17:36:11 +08:00
|
|
|
'vuedraggable-es': ['vuedraggable'],
|
|
|
|
'chart-dark-list_de': ['src/components/icon-group/chart-dark-list.ts'],
|
|
|
|
'chart-list_de': ['src/components/icon-group/chart-list.ts']
|
2024-06-07 15:26:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-09-06 15:19:15 +08:00
|
|
|
modulePreload: {
|
|
|
|
resolveDependencies() {
|
|
|
|
return []
|
|
|
|
}
|
|
|
|
},
|
2024-06-07 15:26:58 +08:00
|
|
|
sourcemap: false
|
|
|
|
}
|
|
|
|
}
|