baixingwenzheng-pc/vite.config.js
2024-01-29 17:57:41 +08:00

30 lines
620 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
} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server: {
port: 5000,
proxy: {
'/api': {
target: 'http://wz.lytv.com.cn/',
// target就是你要访问的目标地址可以是基础地址这样方便在这个网站的其他api口调用数据
ws: true,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
// 要记得加rewrite这句
},
},
},
resolve: {
// Vite路径别名配置
alias: {
'@': path.resolve('./src')
}
}
})