From 06d91cc78c34b612311a7028a4b371ca67ca95b6 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 21 May 2026 11:31:49 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Added=20feature:=20optimize=20bundl?= =?UTF-8?q?e=20size=20with=20lazy=20loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Routes/Router.tsx | 60 ++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/src/Routes/Router.tsx b/src/Routes/Router.tsx index 98046592..d64c7c9a 100644 --- a/src/Routes/Router.tsx +++ b/src/Routes/Router.tsx @@ -1,28 +1,46 @@ +import { lazy, Suspense } from "react"; import { Routes, Route } from "react-router-dom"; -import Tracker from "../pages/Tracker/Tracker.tsx"; -import About from "../pages/About/About"; -import Contact from "../pages/Contact/Contact"; -import Contributors from "../pages/Contributors/Contributors"; -import Signup from "../pages/Signup/Signup.tsx"; -import Login from "../pages/Login/Login.tsx"; -import ContributorProfile from "../pages/ContributorProfile/ContributorProfile.tsx"; -import Custom404 from "../pages/404.tsx"; -import Home from "../pages/Home/Home.tsx"; + +// Lazy loaded pages +const Home = lazy(() => import("../pages/Home/Home.tsx")); +const Tracker = lazy(() => import("../pages/Tracker/Tracker.tsx")); +const About = lazy(() => import("../pages/About/About")); +const Contact = lazy(() => import("../pages/Contact/Contact")); +const Contributors = lazy( + () => import("../pages/Contributors/Contributors") +); +const Signup = lazy(() => import("../pages/Signup/Signup.tsx")); +const Login = lazy(() => import("../pages/Login/Login.tsx")); +const ContributorProfile = lazy( + () => import("../pages/ContributorProfile/ContributorProfile.tsx") +); +const Custom404 = lazy(() => import("../pages/404.tsx")); const Router = () => { return ( - - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - + + Loading... + + } + > + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } + /> + } /> + + ); }; -export default Router; +export default Router; \ No newline at end of file