修改base,增加资源来源地址,修复资源错误加载的问题
This commit is contained in:
@@ -10,7 +10,7 @@ export default defineConfig(async ({ mode }) => {
|
|||||||
const env = loadEnv(mode, process.cwd());
|
const env = loadEnv(mode, process.cwd());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: `/${ env.VITE_SERVER_NAME }/`,
|
base: `http://${ env.VITE_TRAEFIK_ADDRESS }/${ env.VITE_SERVER_NAME }/`,
|
||||||
server: {
|
server: {
|
||||||
port: Number(env.VITE_SERVER_PORT),
|
port: Number(env.VITE_SERVER_PORT),
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
"nacos-federation": "link:../nacos-federation"
|
"nacos-federation": "link:../nacos-federation"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^6.0.1",
|
|
||||||
"@originjs/vite-plugin-federation": "^1.4.1",
|
"@originjs/vite-plugin-federation": "^1.4.1",
|
||||||
|
"@vitejs/plugin-vue": "^6.0.1",
|
||||||
"typescript": "~5.8.3",
|
"typescript": "~5.8.3",
|
||||||
"vite": "^7.1.6"
|
"vite": "^7.1.6"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import axios, { AxiosError, type AxiosInstance, type AxiosRequestConfig } from "axios";
|
import axios, {
|
||||||
|
AxiosError,
|
||||||
|
type AxiosInstance,
|
||||||
|
type AxiosRequestConfig,
|
||||||
|
AxiosResponse,
|
||||||
|
InternalAxiosRequestConfig
|
||||||
|
} from "axios";
|
||||||
import { UrlCheckUtils } from '../utils/index'
|
import { UrlCheckUtils } from '../utils/index'
|
||||||
|
|
||||||
|
|
||||||
@@ -52,9 +58,9 @@ class AxiosInfra {
|
|||||||
* 响应拦截器
|
* 响应拦截器
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
public async ResponseInterceptor(): Promise<any> {
|
public async ResponseInterceptor(): Promise<void> {
|
||||||
this.instance.interceptors.response.use(
|
this.instance.interceptors.response.use(
|
||||||
(response: any) => {
|
(response: AxiosResponse) => {
|
||||||
return response.data.result;
|
return response.data.result;
|
||||||
},
|
},
|
||||||
(error: AxiosError) => {
|
(error: AxiosError) => {
|
||||||
@@ -79,8 +85,8 @@ class AxiosInfra {
|
|||||||
* 添加请求拦截器
|
* 添加请求拦截器
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
public async RequestInterceptor(): Promise<any> {
|
public async RequestInterceptor(): Promise<void> {
|
||||||
this.instance.interceptors.request.use((config: any) => {
|
this.instance.interceptors.request.use((config: InternalAxiosRequestConfig) => {
|
||||||
return config
|
return config
|
||||||
}, function (error: AxiosError) {
|
}, function (error: AxiosError) {
|
||||||
return Promise.reject(error)
|
return Promise.reject(error)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default defineConfig(async ({ mode }): Promise<UserConfig> => {
|
|||||||
const env = loadEnv(mode, process.cwd());
|
const env = loadEnv(mode, process.cwd());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: `/${ env.VITE_SERVER_NAME }/`,
|
base: `http://${ env.VITE_TRAEFIK_ADDRESS }/${ env.VITE_SERVER_NAME }/`,
|
||||||
server: {
|
server: {
|
||||||
port: Number(env.VITE_SERVER_PORT),
|
port: Number(env.VITE_SERVER_PORT),
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
|
|||||||
Reference in New Issue
Block a user