import { fileURLToPath, URL } from 'node:url'; import { defineConfig, loadEnv } from 'vite'; import vue from '@vitejs/plugin-vue'; import vueJsx from '@vitejs/plugin-vue-jsx'; // https://vite.dev/config/ export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), ''); return { base: '/spdm/', plugins: [ vue(), vueJsx(), ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, server: { host: '0.0.0.0', port: 3001, cors: true, proxy: { '/api': { target: env.VITE_API_HTTP_URL, changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''), }, '/wsApi': { target: env.VITE_API_WS_URL, changeOrigin: true, rewrite: (path) => path.replace(/^\/wsApi/, ''), ws: true, }, '/local7101': { // target: 'http://192.168.65.199:7101', // 李东洋 // target: 'http://192.168.65.75:7100/simulation/project', // 朱欣茹 target: 'http://192.168.65.161/api/simulation/project', // 开发环境 // target: 'http://192.168.65.161', // 开发环境 // target: 'http://192.168.65.73:7100', // 开发环境 // target: 'http://192.168.65.53:8080', // 戴琼瑶本地 // target: 'http://192.168.65.53:8080', // 顾龙成本地 changeOrigin: true, rewrite: (path) => path.replace(/^\/local7101/, ''), }, '/local7102': { // taskPool工况库模块 // target: 'http://192.168.65.199:7102', // 李东洋 target: 'http://192.168.65.161:80/api/simulation/task', // 开发环境 // target: 'http://192.168.65.75:7100/simulation/task', // 朱欣茹 // target: 'http://192.168.65.161', // 开发环境 // target: 'http://192.168.65.73:7100', // 开发环境 // target: 'http://192.168.65.53:8080/simulation', // 戴琼瑶本地 // target: 'http://192.168.65.53:8080', // 顾龙成本地 changeOrigin: true, rewrite: (path) => path.replace(/^\/local7102/, ''), }, '/local7103': { // system系统模块 // target: 'http://192.168.65.199:7103', // 李东洋 target: 'http://192.168.65.161:80/api/simulation/system', // 开发环境 // target: 'http://192.168.65.75:7100/simulation/system', // 朱欣茹 changeOrigin: true, // rewrite: (path) => path.replace(/^\/local7103/, ''), rewrite: (path) => { return path.replace(/^\/local7103/, ''); }, }, '/local7104': { // data文件模块 // target: 'http://192.168.65.199:7104', // 李东洋 target: 'http://192.168.65.161:80/api/simulation/data', // 开发环境 // target: 'http://192.168.65.161', // 开发环境 changeOrigin: true, rewrite: (path) => path.replace(/^\/local7104/, ''), }, '/local7107': { // data文件模块 // target: 'http://192.168.65.199:7104', // 李东洋 target: 'http://192.168.65.161:80/api/simulation/capability', // 开发环境 // target: 'http://192.168.65.219:7107', // 戴琼瑶本地 // target: 'http://192.168.65.161', // 开发环境 changeOrigin: true, rewrite: (path) => path.replace(/^\/local7107/, ''), }, }, }, }; });