eacychatting/vite.config.js
2024-11-04 13:37:28 +08:00

21 lines
541 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {defineConfig, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig(({mode}) => {
const env = loadEnv(mode, process.cwd(), "")
return ({
plugins: [vue()],
server: {
proxy: {
'/papi': {
target: `http://${env.VITE_APP_PROXY_BASE_API}/api`,
secure: false, // 如果是https接口需要配置这个参数
changeOrigin: true,
rewrite: (path) => path.replace(/^\/papi/, ''),
}
}
}
})
})