build: Konfiguration für statische Exporte mit Umgebungsvariable optimiert

- output: "export" wird jetzt automatisch bei EXPORT_STATIC=true aktiviert
- Entwicklungsmodus (npm run dev) nutzt weiterhin API-Routen für Mock-Tests
- Neues npm-Skript nutzt cross-env für Umgebungsunabhängigkeit bei Windows/Linux
- cross-env als devDependency hinzugefügt
This commit is contained in:
ISA
2025-04-22 12:21:20 +02:00
parent cfbc56206c
commit 44ae17f6e8
7 changed files with 45 additions and 8 deletions

View File

@@ -1,11 +1,14 @@
/** @type {import('next').NextConfig} */
const isExport = process.env.EXPORT_STATIC === "true";
const nextConfig = {
reactStrictMode: true, // Aktiviert Strict Mode zur Identifizierung potenzieller Probleme in der Anwendung
//output: "export", // Stellt sicher, dass Next.js eine statische Version der Website generiert (SSG)
trailingSlash: false, // Fügt einen Schrägstrich am Ende der URLs hinzu (nützlich für statische Verzeichnisse)
reactStrictMode: true,
trailingSlash: false,
images: {
unoptimized: true, // Verzichtet auf Next.js' Bildoptimierung (nützlich für statische Exporte)
unoptimized: true,
},
...(isExport && { output: "export" }), // ⬅️ dynamisch aktivieren
};
export default nextConfig;