import { defineConfig } from "vite"; import { fileURLToPath, URL } from 'url' 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"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), AutoImport({ // resolvers: [ElementPlusResolver()], }), Components({ // resolvers: [ElementPlusResolver()], directoryAsNamespace: true }), ], resolve: { extensions: ['.js', '.vue'], alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, server: { host: '0.0.0.0', // 解决“vite use `--host` to expose”-- 0.0.0.0 将监听所有地址 proxy: { '/api': { // target: 'http://10.0.0.29:9999', target: 'https://fywz.btdit.cn/', // target: 'http://10.0.0.65:7777/', // 刘进 changeOrigin: true, // rewrite: (path) => path.replace(/^\/api/, '') // ws: true,// 开启webSocket } } } });