添加vite.config.ts简化axios,添加请求跟路径和超时时长

This commit is contained in:
zhangyiming
2020-11-18 18:58:04 +08:00
parent cc6157e12b
commit 3cc8a1f3fe
5 changed files with 35 additions and 33 deletions

26
vite.config.ts Normal file
View File

@@ -0,0 +1,26 @@
module.exports = {
alias: {},
// 是否自动在浏览器打开
open: false,
// 是否开启 https
https: false,
// 服务端渲染
ssr: false,
/**
* Base public path when served in production.
* @default '/'
*/
/**
* Directory relative from `root` where build output will be placed. If the
* directory exists, it will be removed before the build.
* @default 'dist'
*/
// 反向代理
proxy: {
'/api': {
target: 'http://127.0.0.1:3000',
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '')
}
}
}