更改请求路径,配置文件

This commit is contained in:
WUSIJIAN
2025-11-20 13:25:29 +08:00
parent ef5bdecf3a
commit fc07141ba1
3 changed files with 41 additions and 16 deletions

View File

@@ -17,7 +17,7 @@ const alias: Record<string, string> = {
const viteConfig = defineConfig((mode: ConfigEnv) => {
const env = loadEnv(mode.mode, process.cwd());
return {
plugins: [vue(), viteCompression({disable:true})],
plugins: [vue(), viteCompression({ disable: true })],
root: process.cwd(),
resolve: { alias },
base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH,
@@ -27,12 +27,19 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
port: env.VITE_PORT as unknown as number,
open: JSON.parse(env.VITE_OPEN),
hmr: true,
// proxy: {
// '/gitee': {
// target: 'https://gitee.com',
// ws: true,
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/gitee/, ''),
// },
// },
proxy: {
'/gitee': {
target: 'https://gitee.com',
ws: true,
'/api': {
target: 'http://192.168.3.49:8808',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/gitee/, ''),
rewrite: (path) => path.replace(/^\/api/, '/api'),
},
},
},
@@ -54,7 +61,7 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
...(JSON.parse(env.VITE_OPEN_CDN) ? { external: buildConfig.external } : {}),
},
},
css: { preprocessorOptions: { css: { charset: false } , scss:{api:"modern-compiler"}}},
css: { preprocessorOptions: { css: { charset: false }, scss: { api: 'modern-compiler' } } },
define: {
__VUE_I18N_LEGACY_API__: JSON.stringify(false),
__VUE_I18N_FULL_INSTALL__: JSON.stringify(false),