Files
frontend/vite.config.js
NanamiAdmin 34f0d9f6d5 refactor(Logs): use APP_TARGET to read target websocket addr
refactor(config): use APP_TARGET constant for backend URL configuration

Centralize backend URL configuration by introducing APP_TARGET constant in vite.config.js and using it for both WebSocket connection and API proxy. This improves maintainability by having a single source of truth for the backend address.
2026-03-26 16:29:18 +08:00

23 lines
515 B
JavaScript

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const APP_TARGET = '192.168.1.4:38080'
export default defineConfig({
define: {
__APP_TARGET__: JSON.stringify(APP_TARGET)
},
plugins: [vue()],
server: {
host: '0.0.0.0',
port: 3000,
proxy: {
'/api': {
target: `http://${APP_TARGET}`,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
}
})