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

@@ -3,3 +3,4 @@ NEXT_PUBLIC_ENCRYPTION_KEY=1
NEXT_PUBLIC_ENCRYPTION_IV=1
NEXT_PUBLIC_USE_MOCK_BACKEND_TDR_START=true
NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
NEXT_PUBLIC_EXPORT_STATIC=false

View File

@@ -1,4 +1,5 @@
NEXT_PUBLIC_NODE_ENV=production
NEXT_PUBLIC_ENCRYPTION_KEY=1
NEXT_PUBLIC_ENCRYPTION_IV=1
NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_EXPORT_STATIC=true

View File

@@ -1,4 +1,15 @@
"use client";
declare global {
interface Window {
win_kueID?: string[];
win_kueLimit1?: number[];
win_kueDelay1?: number[];
win_kueLimit2Low?: number[];
win_kueLimit2High?: number[];
win_kueLoopInterval?: number[];
}
}
import { useDispatch, useSelector } from "react-redux";
import type { RootState } from "../../../../../redux/store";
import { setKueData } from "../../../../../redux/slices/kueDataSlice";

View File

@@ -6,5 +6,5 @@
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
*/
const webVersion = "1.6.247";
const webVersion = "1.6.248";
export default webVersion;

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;

19
package-lock.json generated
View File

@@ -56,6 +56,7 @@
"@types/react-modal": "^3.16.3",
"@types/redux-mock-store": "^1.5.0",
"@types/testing-library__react": "^10.2.0",
"cross-env": "^7.0.3",
"cypress": "^14.0.0",
"husky": "^8.0.0",
"identity-obj-proxy": "^3.0.0",
@@ -3181,6 +3182,24 @@
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
"dev": true
},
"node_modules/cross-env": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true,
"dependencies": {
"cross-spawn": "^7.0.1"
},
"bin": {
"cross-env": "src/bin/cross-env.js",
"cross-env-shell": "src/bin/cross-env-shell.js"
},
"engines": {
"node": ">=10.14",
"npm": ">=6",
"yarn": ">=1"
}
},
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",

View File

@@ -5,12 +5,13 @@
"scripts": {
"dev": "next dev",
"clean": "rimraf .next out",
"build": "npm run clean && next build",
"build": "npm run clean && cross-env EXPORT_STATIC=true next build && next export",
"postbuild": "copy LICENSE_ICONIFY.txt out\\LICENSE_ICONIFY.txt",
"start": "next start",
"lint": "next lint",
"test": "jest",
"prepare": "husky install"
"prepare": "husky install",
"export": "cross-env EXPORT_STATIC=true next build && next export"
},
"dependencies": {
"@fontsource/roboto": "^5.1.0",
@@ -61,6 +62,7 @@
"@types/react-modal": "^3.16.3",
"@types/redux-mock-store": "^1.5.0",
"@types/testing-library__react": "^10.2.0",
"cross-env": "^7.0.3",
"cypress": "^14.0.0",
"husky": "^8.0.0",
"identity-obj-proxy": "^3.0.0",