guoyu/fronted_uniapp/vite.config.js

45 lines
865 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, '.')
}
},
2025-12-07 00:11:06 +08:00
build: {
rollupOptions: {
external: ['io.dcloud.uts']
}
},
2025-12-03 18:58:36 +08:00
server: {
port: 20003,
host: '0.0.0.0',
open: true,
strictPort: false,
proxy: {
'/api': {
2025-12-07 00:11:06 +08:00
target: 'http://192.168.1.80:30091',
2025-12-03 18:58:36 +08:00
changeOrigin: true,
secure: false
},
// 代理 WebSocket 连接
'/ws': {
2025-12-07 00:11:06 +08:00
target: 'http://192.168.1.80:30091',
2025-12-03 18:58:36 +08:00
ws: true,
changeOrigin: true,
secure: false
}
}
},
optimizeDeps: {
include: ['uview-plus']
}
})