From 4f167cb6585f1b907d0056b1c1a958362f3ec4bc Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Wed, 10 Jun 2026 00:21:33 +0200 Subject: [PATCH] chore(app): add typed global-config module - src/global-config.ts: typed CONFIG (appName, appVersion from package.json, api.baseUrl/debugBaseUrl from VITE_* with fallbacks, isDev) - constants/index.ts re-exports CONFIG and keeps API_URL/DEBUG_API_URL as compat aliases; new code should import CONFIG - vite-env.d.ts: VITE_* env vars typed optional (they may be unset) - Error boundaries use CONFIG.isDev instead of raw import.meta.env.DEV Part 4 of the frontend modernization roadmap. Co-Authored-By: Claude Fable 5 --- app/src/components/ErrorBoundary.tsx | 4 +++- app/src/components/RouteErrorBoundary.tsx | 3 ++- app/src/constants/index.ts | 11 ++++----- app/src/global-config.ts | 27 +++++++++++++++++++++++ app/src/vite-env.d.ts | 4 ++-- 5 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 app/src/global-config.ts diff --git a/app/src/components/ErrorBoundary.tsx b/app/src/components/ErrorBoundary.tsx index b220fb158d..28fcda186a 100644 --- a/app/src/components/ErrorBoundary.tsx +++ b/app/src/components/ErrorBoundary.tsx @@ -9,6 +9,8 @@ import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Typography from '@mui/material/Typography'; +import { CONFIG } from 'src/global-config'; + interface Props { children: ReactNode; fallback?: ReactNode; @@ -210,7 +212,7 @@ export class ErrorBoundary extends Component { )} - {componentStack && import.meta.env.DEV && !showDetails && ( + {componentStack && CONFIG.isDev && !showDetails && ( {body} - {import.meta.env.DEV && ( + {CONFIG.isDev && ( interface ImportMetaEnv { - readonly VITE_API_URL: string; - readonly VITE_DEBUG_API_URL: string; + readonly VITE_API_URL?: string; + readonly VITE_DEBUG_API_URL?: string; } interface ImportMeta {