feat: 20250610 自动分包(利用浏览器缓存)

This commit is contained in:
mac·ufutx 2025-06-10 17:18:33 +08:00
parent db264fb08b
commit 5c0cedd642

View File

@ -16,6 +16,18 @@ export default defineConfig({
svgo: { plugins: [{ name: 'removeViewBox' }] }
})
],
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
// 将第三方库单独分包(如 axios、vue 等)
return id.split('node_modules/')[1].split('/')[0]
}
}
}
}
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src') // 添加路径别名