/**
 * 设置网络代理
 * @param isOpenProxy - 是否开启代理
 * @param envConfig - env环境配置
 */
export function createViteProxy(isOpenProxy, envConfig) {
  console.log('createViteProxy:', isOpenProxy, envConfig);
  if (!isOpenProxy) return undefined;
  const proxy = {
    [envConfig.proxy]: {
      target: envConfig.url,
      changeOrigin: true,
      // rewrite: (path) => path.replace(new RegExp(`^${envConfig.proxy}`), ''),
    },
  };
  console.log('proxy:', proxy);
  return proxy;
}
