mirror of
https://github.com/yangzongzhuan/RuoYi-Vue3.git
synced 2025-09-27 14:52:40 +00:00
update vite.config.js
This commit is contained in:
@@ -2,6 +2,8 @@ import { defineConfig, loadEnv } from 'vite'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import createVitePlugins from './vite/plugins'
|
import createVitePlugins from './vite/plugins'
|
||||||
|
|
||||||
|
const baseUrl = 'http://localhost:8080' // 后端接口
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ mode, command }) => {
|
export default defineConfig(({ mode, command }) => {
|
||||||
const env = loadEnv(mode, process.cwd())
|
const env = loadEnv(mode, process.cwd())
|
||||||
@@ -46,9 +48,14 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
proxy: {
|
proxy: {
|
||||||
// https://cn.vitejs.dev/config/#server-proxy
|
// https://cn.vitejs.dev/config/#server-proxy
|
||||||
'/dev-api': {
|
'/dev-api': {
|
||||||
target: 'http://localhost:8080',
|
target: baseUrl,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
||||||
|
},
|
||||||
|
// springdoc proxy
|
||||||
|
'^/v3/api-docs/(.*)': {
|
||||||
|
target: baseUrl,
|
||||||
|
changeOrigin: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user