baixingwenzheng-pc/vite.config.js

30 lines
620 B
JavaScript
Raw Normal View History

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