guoyu/fronted_uniapp/vite.config.js

40 lines
786 B
JavaScript
Raw Normal View History

2025-12-03 18:58:36 +08:00
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import path from 'path'
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
plugins: [uni()],
resolve: {
alias: {
'@': path.resolve(__dirname, '.')
}
},
server: {
port: 20003,
host: '0.0.0.0',
open: true,
strictPort: false,
proxy: {
'/api': {
2025-12-06 20:11:25 +08:00
target: 'http://192.168.1.8:30091',
2025-12-03 18:58:36 +08:00
changeOrigin: true,
secure: false
},
// 代理 WebSocket 连接
'/ws': {
2025-12-06 20:11:25 +08:00
target: 'http://192.168.1.8:30091',
2025-12-03 18:58:36 +08:00
ws: true,
changeOrigin: true,
secure: false
}
}
},
optimizeDeps: {
include: ['uview-plus']
}
})