import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import { fileURLToPath, URL } from 'node:url' // https://vitejs.dev/config/ export default defineConfig({ build: { rollupOptions: { output: { // 在这里修改静态资源路径 chunkFileNames: 'amisStatic/assets/js/[name]-[hash].js', entryFileNames: 'amisStatic/assets/js/[name]-[hash].js', assetFileNames: 'amisStatic/assets/[ext]/[name]-[hash].[ext]', } } }, minify: true, plugins: [react()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, server: { host: "0.0.0.0", proxy: { '/api': { // target: "http://10.10.10.107:9208",// 目标地址 target: `http://10.10.10.168:8080`,// sar目标地址 // target: `http://10.10.10.200/api/`,// 测试服务器址 // target: "http://10.10.10.146:9309",// Rock目标地址 // target: `http://togy.top:18080/api/`,// sar目标地址 ws: true,// 开始ws代理 changeOrigin: true, // 开发模式 rewrite: (path) => path.replace(/^\/api/, "") }, } }, })