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)) }, }, server: { port: 5173, proxy: { // real 模式时代理到本地网关;mock 模式由 msw 在浏览器网络层拦截。 // 网关自 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'], }, })