/* * @Author: BINGWU * @Date: 2024-01-20 23:24:08 * @LastEditors: BINGWU HuJiaCheng2003@163.com * @LastEditTime: 2024-01-29 18:09:25 * @FilePath: \bingwu-admin\vite.config.js * @Describe: * @Mark: ૮(˶ᵔ ᵕ ᵔ˶)ა */ import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), AutoImport({ resolvers: [ElementPlusResolver()] }), Components({ resolvers: [ElementPlusResolver()] }) ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, server: { open: true, // 是否主动唤醒浏览器, proxy: { '/api': { target: ' http://localhost:6699', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '') // 不可以省略rewrite } } } })