mirror of
https://github.com/wmn1525/grasscutterTools.git
synced 2024-11-16 04:45:37 +00:00
25 lines
649 B
TypeScript
25 lines
649 B
TypeScript
import {
|
|
API_BASE_URL,
|
|
API_TARGET_URL,
|
|
MOCK_API_BASE_URL,
|
|
MOCK_API_TARGET_URL,
|
|
} from '../../config/constant';
|
|
import { ProxyOptions } from 'vite';
|
|
type ProxyTargetList = Record<string, ProxyOptions>;
|
|
|
|
const init: ProxyTargetList = {
|
|
// test
|
|
[API_BASE_URL]: {
|
|
target: API_TARGET_URL,
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(new RegExp(`^${API_BASE_URL}`), ''),
|
|
},
|
|
// mock
|
|
[MOCK_API_BASE_URL]: {
|
|
target: MOCK_API_TARGET_URL,
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(new RegExp(`^${MOCK_API_BASE_URL}`), '/api'),
|
|
},
|
|
};
|
|
|
|
export default init; |