diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..e4faeda --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,7 @@ +# Bolt's Performance Journal + +## 2025-05-18 - Route-based Code Splitting in Single-Page Application + +**Learning:** Static imports of all top-level page components in `client/src/App.tsx` caused Vite to bundle all pages into a single monolithic entry chunk (`1,695 kB` uncompressed / `441 kB` gzipped). This resulted in downloading code for the entire application upfront, including heavy dashboard modules (`Dashboard` is ~950 kB). By converting route page components to dynamic imports (`React.lazy()` with `Suspense`), Vite automatically splits pages into separate lazy-loaded chunks. + +**Action:** Always use `React.lazy()` for route-level components in React applications using Vite/Wouter/React-Router to keep initial bundle sizes minimal (<500 kB) and load page JS on-demand as users navigate. diff --git a/client/src/App.tsx b/client/src/App.tsx index c206b18..f9f3983 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -3,24 +3,28 @@ import { useState, useEffect, useRef } from "react"; import { queryClient } from "./lib/queryClient"; import { QueryClientProvider } from "@tanstack/react-query"; import { Toaster } from "@/components/ui/toaster"; -import NotFound from "@/pages/not-found"; -import Dashboard from "@/pages/Dashboard"; -import MainframeDashboard from "@/pages/MainframeDashboard"; -import WebhookManagement from "@/pages/WebhookManagement"; -import AccessibilityPage from "@/pages/AccessibilityPage"; -import PricingPage from "@/pages/PricingPage"; -import IndividualIdPage from "@/pages/IndividualIdPage"; -import DisasterRecoveryPage from "@/pages/DisasterRecoveryPage"; +import { lazy, Suspense } from "react"; import SupportBubble from "@/components/SupportBubble"; import SmoothScrollLink from "@/components/SmoothScrollLink"; import ScrollToTop from "@/components/ScrollToTop"; import PinkSyncWidget from "@/components/PinkSyncWidget"; import { GestureEasterEgg } from "@/components/GestureEasterEgg"; import { EasterEggHints } from "@/components/EasterEggHints"; -import SitemapPage from "@/pages/SitemapPage"; import { Menu, X, ChevronRight, ChevronDown, Github } from "lucide-react"; import "@/styles/ScrollStyles.css"; +// Performance Optimization: Lazy load route components for code splitting +// Reduces initial JavaScript bundle size significantly on page load +const NotFound = lazy(() => import("@/pages/not-found")); +const Dashboard = lazy(() => import("@/pages/Dashboard")); +const MainframeDashboard = lazy(() => import("@/pages/MainframeDashboard")); +const WebhookManagement = lazy(() => import("@/pages/WebhookManagement")); +const AccessibilityPage = lazy(() => import("@/pages/AccessibilityPage")); +const PricingPage = lazy(() => import("@/pages/PricingPage")); +const IndividualIdPage = lazy(() => import("@/pages/IndividualIdPage")); +const DisasterRecoveryPage = lazy(() => import("@/pages/DisasterRecoveryPage")); +const SitemapPage = lazy(() => import("@/pages/SitemapPage")); + function MainNav() { const [isMenuOpen, setIsMenuOpen] = useState(false); const [activeSection, setActiveSection] = useState(null); @@ -470,104 +474,110 @@ function Router({ initialUserId }: { initialUserId: number }) {
- - - - - - - - - - - - - - - - - - - - -
-

Interactive Demo

-

- Experience the power of NegraRosa Security with our interactive demos -

-
-
-

User Experience Demo

-

- See how verification works from the user's perspective -

- -
-
-

Business Integration Demo

-

- Explore how businesses can integrate our verification system -

- + +
+
+ }> + + + + + + + + + + + + + + + + + + + + +
+

Interactive Demo

+

+ Experience the power of NegraRosa Security with our interactive demos +

+
+
+

User Experience Demo

+

+ See how verification works from the user's perspective +

+ +
+
+

Business Integration Demo

+

+ Explore how businesses can integrate our verification system +

+ +
-
- - - - - - - - - - - - - - - - - -
-
-

Login or Register

-
-
-
- - -
-
- - -
- -
- - Don't have an account? Register - + + + + + + + + + + + + + + + + + +
+
+

Login or Register

+
+
+
+ + +
+
+ + +
+ +
+ + Don't have an account? Register + +
-
- - - + + + +