fix(vite.config.ts): API接口路径调整

This commit is contained in:
郝先瑞
2022-01-29 12:45:27 +08:00
parent b3b4e78f2c
commit 33520a38b8

View File

@@ -29,7 +29,7 @@ export default ({command, mode}: ConfigEnv): UserConfig => {
open: true, // 运行自动打开浏览器 open: true, // 运行自动打开浏览器
proxy: { proxy: {
[env.VITE_APP_BASE_API]: { [env.VITE_APP_BASE_API]: {
target: 'http://www.youlai.tech:9999', target: 'http://localhost:9999',
changeOrigin: true, changeOrigin: true,
rewrite: path => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '') rewrite: path => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
} }
@@ -40,42 +40,7 @@ export default ({command, mode}: ConfigEnv): UserConfig => {
// Vite2设置别名路径方式一 // Vite2设置别名路径方式一
alias: { alias: {
"@": path.resolve("./src"), // 相对路径别名配置,@表示src "@": path.resolve("./src"), // 相对路径别名配置,@表示src
}, }
// Vite2设置别名路径方式二
// alias: [
// {
// find: "@",
// replacement: path.resolve("./src")
// },
// {
// find: "@image",
// replacement: path.resolve("./src/assets/images")
// },
// {
// find: "@/router",
// replacement: path.resolve("./src/router")
// },
// {
// find: "@/store",
// replacement: path.resolve("./src/store")
// },
// {
// find: "@/api",
// replacement: path.resolve("./src/api")
// },
// {
// find: "@/utils",
// replacement: path.resolve("./src/utils")
// },
// {
// find: "@/views",
// replacement: path.resolve("./src/views")
// },
// {
// find: "@/styles",
// replacement: path.resolve("./src/styles")
// },
// ]
} }
} }