11
This commit is contained in:
parent
7b51376c5b
commit
553b76cd3b
@ -2,8 +2,9 @@
|
|||||||
import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
|
import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
|
||||||
|
|
||||||
// 从环境变量读取基础 URL
|
// 从环境变量读取基础 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 实例
|
// 创建 axios 实例
|
||||||
const request: AxiosInstance = axios.create({
|
const request: AxiosInstance = axios.create({
|
||||||
baseURL: BASE_URL,
|
baseURL: BASE_URL,
|
||||||
|
|||||||
@ -5,11 +5,6 @@ import { fileURLToPath, URL } from "node:url";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue()],
|
plugins: [vue()],
|
||||||
// resolve: {
|
|
||||||
// alias: {
|
|
||||||
// '@': fileURLToPath(new URL('./src', import.meta.url))
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@": path.resolve(__dirname, "src"),
|
"@": path.resolve(__dirname, "src"),
|
||||||
@ -19,5 +14,13 @@ export default defineConfig({
|
|||||||
port: 8080, // 设置开发服务器端口为 8080
|
port: 8080, // 设置开发服务器端口为 8080
|
||||||
host: true,
|
host: true,
|
||||||
open: 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