40 lines
790 B
JavaScript
40 lines
790 B
JavaScript
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': {
|
|
target: 'http://192.168.0.106:30091',
|
|
changeOrigin: true,
|
|
secure: false
|
|
},
|
|
// 代理 WebSocket 连接
|
|
'/ws': {
|
|
target: 'http://192.168.0.106:30091',
|
|
ws: true,
|
|
changeOrigin: true,
|
|
secure: false
|
|
}
|
|
}
|
|
},
|
|
optimizeDeps: {
|
|
include: ['uview-plus']
|
|
}
|
|
})
|
|
|