配置了vite.config.js文件之后还是代理无效
import {
defineConfig
} from 'vite'
import uni from '@dcloudio/vite-plugin-uni' // 引用官方插件
export default defineConfig({
plugins: [
uni()
],
server: {
port: 5173,
// 代理域名
proxy: {
'/api': {
target: 'http://localhost:4000',
rewrite: (path) => path.replace(/^\/api/, '')
}
}
}
})