From b46f14bad9826ec1b2f7ef92fdabd617384a603d Mon Sep 17 00:00:00 2001 From: d3v1l0n Date: Sun, 29 Dec 2024 05:57:37 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20build:=20make=20sure=20we=20hand?= =?UTF-8?q?le=20the=20root=20elements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index ea9e3630..756428b4 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,9 +1,16 @@ import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; -import App from './App.tsx'; +import App from './App'; import './index.css'; -createRoot(document.getElementById('root')!).render( +// Ensure 'root' element exists to avoid runtime errors +const rootElement = document.getElementById('root'); +if (!rootElement) { + throw new Error('Root element not found'); +} + +const root = createRoot(rootElement); +root.render(