You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Water_Machine_Management_Sy.../target/classes/web/vite.config.ts

35 lines
1.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
],
resolve: {
alias: {
'@': '/src'
},
},
server: {
proxy: {
// 代理所有以 /api 开头的请求到后端
'/api': {
target: 'http://localhost:8080', // Spring Boot 后端地址
changeOrigin: true, // 改变请求来源
secure: false, // 如果是https可能需要设置为false
// 如果需要重写路径,可以取消下面的注释
// rewrite: (path) => path.replace(/^\/api/, '')
},
// 如果需要代理其他路径,可以继续添加
// '/ws': {
// target: 'ws://localhost:8080',
// ws: true
// }
},
// 可选:设置端口
port: 5173, // Vite默认端口
// 可选:自动打开浏览器
open: true
}
})