Skip to content

Commit

Permalink
perf: 字节visactor分片
Browse files Browse the repository at this point in the history
  • Loading branch information
oljc committed May 10, 2024
1 parent 2760988 commit d734123
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
alias: {
'@': resolve(__dirname, 'src'),
'assets': resolve(__dirname, 'src/assets'),
'vue': 'vue/dist/vue.esm-bundler.js', // compile template
},
'vue': 'vue/dist/vue.esm-bundler.js' // compile template
}
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
hack: `true; @import (reference) "${resolve(
'src/assets/style/variables.less',
)}";`,
'src/assets/style/variables.less'
)}";`
},
// https://lesscss.org/usage/#less-options
math: 'parens-division',
javascriptEnabled: true,
},
},
javascriptEnabled: true
}
}
},
plugins: [pluginsList()],
// 依赖预构建-> https://cn.vitejs.dev/config/dep-optimization-options#dep-optimization-options
optimizeDeps: {
include: ['mitt', 'dayjs', 'axios', 'pinia', '@vueuse/core', 'vue-i18n'],
exclude: ['@iconify-icons/lets-icons'],
exclude: ['@iconify-icons/lets-icons']
},
server: {
// 允许跨域
Expand All @@ -49,8 +49,8 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
// 预热文件以降低启动期间的初始页面加载时长
warmup: {
// 预热的客户端文件:首页、views、 components
clientFiles: ['./index.html', './src/{views,components}/*'],
},
clientFiles: ['./index.html', './src/{views,components}/*']
}
},
build: {
// 浏览器兼容目标
Expand All @@ -66,13 +66,13 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
// 自定义 chunk
manualChunks: {
arco: ['@arco-design/web-vue'],
chart: ['echarts', 'vue-echarts'],
vue: ['vue', 'vue-router', 'pinia', '@vueuse/core', 'vue-i18n'],
},
},
chart: ['@visactor/vchart'],
vue: ['vue', 'vue-router', 'pinia', '@vueuse/core', 'vue-i18n']
}
}
},
// chunk 大小警告的限制
chunkSizeWarningLimit: 2000,
},
chunkSizeWarningLimit: 2000
}
};
};

0 comments on commit d734123

Please sign in to comment.