一、通过配置文件配置proxy.ts设置代理
在生产环境 代理是无法生效的
export default {
dev: {
'/api/': {
target: 'http://localhost:21021',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
test: {
'/api/': {
target: 'https://preview.pro.ant.design',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
pre: {
'/api/': {
target: 'your pre url',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
};
二、package.json文件中增加代理
"proxy": "http://clean.bathon.cn:6565",



