import { fileURLToPath, URL } from 'node:url' import { defineConfig, loadEnv } from 'vite' import vue from '@vitejs/plugin-vue' import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import Unocss from 'unocss/vite' export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), '') return { base: '/', plugins: [ vue(), Unocss(), AutoImport({ resolvers: [ElementPlusResolver()], imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'], dts: 'src/auto-import.d.ts', }), Components({ resolvers: [ElementPlusResolver()], dirs: ['src/components'], extensions: ['vue'], dts: 'src/components.d.ts', }), ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, server: { proxy: { [env.VITE_BASE_API]: { target: env.VITE_BASE_PATH, changeOrigin: true, }, }, hmr: { overlay: false, }, }, } })