init
This commit is contained in:
21
build/vite/proxy.ts
Normal file
21
build/vite/proxy.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { ProxyOptions } from 'vite';
|
||||
import { API_BASE_URL, API_TARGET_URL, MOCK_API_BASE_URL, MOCK_API_TARGET_URL } from '../constant';
|
||||
|
||||
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;
|
Reference in New Issue
Block a user