JiShe.IOT.UI/apps/web-antd/vite.config.mts

33 lines
897 B
TypeScript
Raw Permalink Normal View History

2025-05-27 19:31:37 +08:00
import { defineConfig } from '@vben/vite-config';
import { loadEnv } from 'vite';
export default defineConfig(async (config) => {
const { command, mode } = config as { command: string; mode: string };
const env = loadEnv(mode, process.cwd());
console.log(env, '-----------env', command);
return {
application: {},
vite: {
server: {
proxy: {
'/proxy': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/proxy/, ''),
// mock代理目标地址
target: env.VITE_APP_API_ADDRESS,
ws: true,
},
// '/api': {
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, ''),
// // mock代理目标地址
// target: 'http://localhost:5320/api',
// ws: true,
// },
},
},
},
};
});