/* * @Author : yuan * @Date : 2025-09-28 09:31:16 * @LastEditors : yuan * @LastEditTime : 2025-09-28 09:40:50 * @FilePath : \build\config\proxy.js * @Description : * Copyright 2025 OBKoro1, All Rights Reserved. * 2025-09-28 09:31:16 */ export const createViteProxy = (env) => { const { VITE_APP_PROXY, VITE_API_PREFIX, VITE_API_BASE_URL } = env // 不使用代理直接返回 if (!JSON.parse(VITE_APP_PROXY)) return undefined const proxy = { [VITE_API_PREFIX]: { target: VITE_API_BASE_URL, changeOrigin: true, rewrite: path => path.replace(new RegExp(`^${VITE_API_PREFIX}`), ''), }, } return proxy }