Description
Heavy dependencies like Three.js (@react-three/fiber, three), TensorFlow.js, Pyodide, and D3 significantly increase bundle size. Implement dynamic imports, route-based code splitting, and lazy loading for non-critical features (AR/VR, 3D lab, metaverse, BCI) to improve initial load time.
Files to Modify
frontend/src/app/layout.tsx — Dynamic import config
frontend/next.config.js — Bundle analyzer config
- Component files with heavy deps — Convert to dynamic imports
frontend/src/components/ARVR/ — Lazy load all VR components
frontend/src/components/Metaverse/ — Lazy load 3D components
frontend/src/components/Lab/ — Lazy load lab sim
Definition of Done
Description
Heavy dependencies like Three.js (@react-three/fiber, three), TensorFlow.js, Pyodide, and D3 significantly increase bundle size. Implement dynamic imports, route-based code splitting, and lazy loading for non-critical features (AR/VR, 3D lab, metaverse, BCI) to improve initial load time.
Files to Modify
frontend/src/app/layout.tsx— Dynamic import configfrontend/next.config.js— Bundle analyzer configfrontend/src/components/ARVR/— Lazy load all VR componentsfrontend/src/components/Metaverse/— Lazy load 3D componentsfrontend/src/components/Lab/— Lazy load lab simDefinition of Done
next/dynamicwithssr: false