39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
resolve: {
|
|
alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
// S3·FE-6 单包<500KB(gzip):主包曾 1.27MB(裸)/410KB(gzip)——
|
|
// element-plus 全量与 vue 系拆 vendor chunk,业务主包独立小包;
|
|
// 页面级全部动态 import(路由懒加载已有),首屏只拉 entry+两 vendor。
|
|
manualChunks: {
|
|
'element-plus': ['element-plus', '@element-plus/icons-vue'],
|
|
'vue-vendor': ['vue', 'vue-router', 'pinia', 'axios'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
// real 模式时代理到本地网关(S3 起 Mock 已下线,单一 real 通道)。
|
|
// 网关自 Day42 起按 configs/config.dev.yaml 稳定监听 :8080
|
|
// (历史 8081 为当时 8080 被宿主机旧进程占用时的临时 env 覆盖,已废弃)。
|
|
'/api': { target: 'http://127.0.0.1:8080', changeOrigin: true },
|
|
},
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
include: ['tests/**/*.spec.ts'],
|
|
setupFiles: ['./vitest.setup.ts'],
|
|
},
|
|
})
|