vben-admin-thin-next/build/config/vite/proxy.ts

16 lines
350 B
TypeScript
Raw Normal View History

2020-09-28 20:19:10 +08:00
type ProxyItem = [string, string];
type ProxyList = ProxyItem[];
export function createProxy(list: ProxyList) {
const ret: any = {};
for (const [prefix, target] of list) {
ret[prefix] = {
target: target,
changeOrigin: true,
rewrite: (path: string) => path.replace(new RegExp(`^${prefix}`), ''),
};
}
return ret;
}