prototype 1.0
This commit is contained in:
@@ -1,64 +1,17 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import path from "path"
|
||||
import tailwindcss from "@tailwindcss/vite"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import { defineConfig } from "vite"
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
// Режим прямого подключения к одиночной ноде (dev-direct)
|
||||
if (mode === 'development.direct') {
|
||||
return {
|
||||
plugins: [react()],
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/v1': 'http://localhost:8080',
|
||||
'/api': {
|
||||
target: 'http://localhost:8445', // возвращаемся к порту 8445
|
||||
changeOrigin: true,
|
||||
// rewrite больше не нужен, т.к. на 8445 уже правильный путь /admin/users
|
||||
},
|
||||
'/ws': {
|
||||
target: 'ws://localhost:8446',
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
define: {
|
||||
'import.meta.env.VITE_BASENAME': JSON.stringify(process.env.VITE_BASENAME || ''),
|
||||
}
|
||||
|
||||
// Режим разработки через Traefik (кластер, dev)
|
||||
if (mode === 'development') {
|
||||
return {
|
||||
plugins: [react()],
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/v1': {
|
||||
target: 'https://localhost',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
headers: {
|
||||
Host: 'admin-api.eventhub.local',
|
||||
},
|
||||
},
|
||||
'/api': {
|
||||
target: 'https://localhost',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
headers: {
|
||||
Host: 'admin-api.eventhub.local',
|
||||
},
|
||||
rewrite: (path) => path.replace(/^\/api/, '/api/admin'),
|
||||
},
|
||||
'/ws': {
|
||||
target: 'wss://localhost',
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Production (сборка) – прокси не используется, запросы идут через Nginx/Docker
|
||||
return {
|
||||
plugins: [react()],
|
||||
};
|
||||
});
|
||||
})
|
||||
Reference in New Issue
Block a user