import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; import path from 'path'; import { fileURLToPath } from 'url'; import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' // import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' // 获取当前文件的目录名 const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); export default defineConfig({ plugins: [vue(), // AutoImport({ // resolvers: [ElementPlusResolver()], // }), // Components({ // resolvers: [ElementPlusResolver()], // }), ], resolve: { alias: { '@': path.resolve(__dirname, './src'), }, }, server: { proxy: { '/api': { // target: 'http://10.113.233.180:8080', target: 'http://localhost:8080', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '') } } } });