11
This commit is contained in:
parent
7b51376c5b
commit
553b76cd3b
@ -2,8 +2,9 @@
|
||||
import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
|
||||
|
||||
// 从环境变量读取基础 URL
|
||||
const BASE_URL = import.meta.env.VITE_API_BASIC;
|
||||
|
||||
const BASE_URL = import.meta.env.MODE === 'development'?'http://10.10.1.27:8888':'http://10.10.1.27:8888';
|
||||
console.log('API Basic URL:', BASE_URL);
|
||||
console.log('All env:', import.meta.env);
|
||||
// 创建 axios 实例
|
||||
const request: AxiosInstance = axios.create({
|
||||
baseURL: BASE_URL,
|
||||
|
||||
@ -5,11 +5,6 @@ import { fileURLToPath, URL } from "node:url";
|
||||
import path from "path";
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
// resolve: {
|
||||
// alias: {
|
||||
// '@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
// }
|
||||
// },
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "src"),
|
||||
@ -19,5 +14,13 @@ export default defineConfig({
|
||||
port: 8080, // 设置开发服务器端口为 8080
|
||||
host: true,
|
||||
open: true, // 可选:启动时自动打开浏览器
|
||||
proxy: {
|
||||
"/v1": {
|
||||
target: "http://10.10.1.27:8888",
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/v1/, '')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user