From 73ede769b6887db82dc1b7c2d9bd456dea67b171 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Tue, 2 Sep 2025 08:50:05 +0000 Subject: [PATCH] Add debugging to help diagnose why the application isn't loading Add comprehensive logging and error handling to the client-side entry point and index.html to identify and report issues preventing the React application from mounting. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 890577b1-c154-40a4-a177-a0c6d55320c3 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/890577b1-c154-40a4-a177-a0c6d55320c3/DyHCx4q --- client/index.html | 23 +++++++++++++++++++++++ client/src/main.tsx | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/client/index.html b/client/index.html index 3fea956..6c168af 100644 --- a/client/index.html +++ b/client/index.html @@ -57,5 +57,28 @@
+ + + \ No newline at end of file diff --git a/client/src/main.tsx b/client/src/main.tsx index 0945fc0..f681e6f 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -2,6 +2,8 @@ import { createRoot } from "react-dom/client"; import App from "./App"; import "./index.css"; +console.log('🎬 main.tsx starting...'); + // Registracija Service Worker-ja za PWA funkcionalnost if ('serviceWorker' in navigator) { window.addEventListener('load', () => { @@ -15,4 +17,35 @@ if ('serviceWorker' in navigator) { }); } -createRoot(document.getElementById("root")!).render(); +try { + const rootElement = document.getElementById("root"); + console.log('🎯 Root element found:', rootElement); + + if (!rootElement) { + throw new Error('Root element not found'); + } + + console.log('🚀 Creating React root...'); + const root = createRoot(rootElement); + + console.log('🎭 Rendering App component...'); + root.render(); + + console.log('✅ React app mounted successfully'); +} catch (error) { + console.error('❌ Failed to mount React app:', error); + + // Fallback error display + const rootElement = document.getElementById("root"); + if (rootElement) { + rootElement.innerHTML = ` +
+
+

Critical Error: React app failed to start

+

Error: ${error instanceof Error ? error.message : 'Unknown error'}

+

Check browser console for details

+
+
+ `; + } +}