feat: 20250610 自动分包(利用浏览器缓存)
This commit is contained in:
parent
db264fb08b
commit
5c0cedd642
@ -16,6 +16,18 @@ export default defineConfig({
|
|||||||
svgo: { plugins: [{ name: 'removeViewBox' }] }
|
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: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.resolve(__dirname, 'src') // 添加路径别名
|
'@': path.resolve(__dirname, 'src') // 添加路径别名
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user