import { fileURLToPath, URL } from 'node:url'; import { defineConfig, loadEnv } from 'vite'; import vue from '@vitejs/plugin-vue'; // vant import Components from 'unplugin-vue-components/vite'; import { VantResolver } from 'unplugin-vue-components/resolvers'; const path = require('path'); const common = path.resolve(__dirname, '../common'); export default defineConfig(({ mode }) => { const env = loadEnv(mode, __dirname); return { // 静态路径 base: env.VITE_BASE_URL, // 打包名称 build: { outDir: env.VITE_OUT_DIR }, plugins: [ vue(), Components({ resolvers: [VantResolver()] }) ], server: { port: 8008, proxy: { '/files': { target: 'http://basic.waityou24.cn' }, '/jcyjdtglpt/v1/api': { target: 'http://192.168.1.113:13010', changeOrigin: true, ws: false }, '/freeLabel/v2/api': { target: 'http://192.168.1.113:13002', // http://192.168.1.197:13002 //http://192.168.1.197:13202 changeOrigin: true, ws: false } }, fs: { strict: false } }, resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), '@common': common } } }; });