feat(frontend): Anpassung der Vite-Konfiguration und Verbesserung der API-Basis-URL

- Hinzufügen von Umgebungsvariablen zur Vite-Konfiguration für die Produktionsumgebung.
- Anpassung der API-Basis-URL in axios.js, um sicherzustellen, dass immer der Apache-Proxy für die Produktion verwendet wird.
This commit is contained in:
Torsten Schulz (local)
2025-08-29 09:20:06 +02:00
parent 7b9279ef29
commit bc4397bcae
2 changed files with 9 additions and 8 deletions

View File

@@ -1,24 +1,18 @@
import axios from 'axios';
import store from '../store';
// API-Basis-URL basierend auf der Umgebung
// API-Basis-URL - immer über Apache-Proxy für Produktion
const getApiBaseURL = () => {
// Wenn explizite Umgebungsvariable gesetzt ist, diese verwenden
if (import.meta.env.VITE_API_BASE_URL) {
return import.meta.env.VITE_API_BASE_URL;
}
// In Entwicklung: direkte Backend-Verbindung
if (import.meta.env.DEV) {
return 'http://localhost:3001';
}
// In Produktion: über Apache-Proxy
// Für Produktion: immer über Apache-Proxy
return '/api';
};
// Debug-Informationen
console.log('🌍 Environment:', import.meta.env.MODE);
console.log('🔗 API Base URL:', getApiBaseURL());
const apiClient = axios.create({

View File

@@ -6,6 +6,13 @@ import path from 'path';
export default defineConfig({
plugins: [vue()],
define: {
// Explizit Produktionsumgebung setzen
__DEV__: false,
'import.meta.env.DEV': false,
'import.meta.env.PROD': true,
'import.meta.env.MODE': '"production"'
},
optimizeDeps: {
esbuildOptions: {
plugins: [