2026-04-30 18:48:40 +08:00
|
|
|
import { defineConfig, loadEnv } from 'vite'
|
2026-04-30 16:59:06 +08:00
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
import { resolve } from 'path'
|
2026-04-30 18:48:40 +08:00
|
|
|
import fs from 'fs'
|
2026-04-30 16:59:06 +08:00
|
|
|
|
2026-04-30 18:48:40 +08:00
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
|
|
|
const localIP = env.VITE_LOCAL_IP || '127.0.0.1'
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
plugins: [vue()],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': resolve(__dirname, 'src'),
|
|
|
|
|
'@xuqm/vue3-sdk': resolve(__dirname, '../XuqmGroup-Vue3SDK/dist/index.es.js'),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
server: {
|
|
|
|
|
port: 5173,
|
|
|
|
|
host: true,
|
|
|
|
|
https: {
|
|
|
|
|
key: fs.readFileSync(resolve(__dirname, '../.certs/local-key.pem')),
|
|
|
|
|
cert: fs.readFileSync(resolve(__dirname, '../.certs/local.pem')),
|
|
|
|
|
},
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api/demo': {
|
|
|
|
|
target: `http://${localIP}:8085`,
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
'/api/im': {
|
|
|
|
|
target: `http://${localIP}:8082`,
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
ws: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-04-30 16:59:06 +08:00
|
|
|
},
|
2026-04-30 18:48:40 +08:00
|
|
|
}
|
2026-04-30 16:59:06 +08:00
|
|
|
})
|