Code Splitting
تقسيم الكود (Code Splitting)
Definition
Breaking a JavaScript bundle into smaller chunks loaded on demand, reducing initial page load time.
تقسيم حزمة JavaScript إلى أجزاء أصغر تُحمَّل عند الطلب، مما يُقلّل وقت تحميل الصفحة الأولي.
Why It Matters
The heavy GlossaryText tooltip component in 404Fault could be dynamically imported to reduce the initial JS bundle on pages that don't need tooltips.
مكوّن GlossaryText الثقيل في 404Fault يمكن استيراده ديناميكيًا لتقليل حزمة JS الأولية على الصفحات التي لا تحتاج إلى تلميحات.
Full Definition
Example Usage
“const GlossaryText = dynamic(() => import('@/components/glossary/GlossaryText'), { loading: () => <span>...</span>, ssr: false });”
“const GlossaryText = dynamic(() => import('@/components/glossary/GlossaryText'), { loading: () => <span>...</span>, ssr: false });”
AI Builder Tips
Avoid these mistakes when using Code Splitting:
Code splitting everything — adds overhead for small chunks that don't save meaningful loading time
Not providing loading UI — users see a blank flash while the chunk loads
Sign in to unlock guided AI explanations from AI Teacher.
Generate a Prompt
Copy this prompt and use it directly with any AI model — no setup needed.
Help me build a project using Code Splitting. Explain: 1. What is Code Splitting and why it matters 2. The core architecture and required tools 3. Step-by-step implementation plan 4. Common mistakes to avoid: Code splitting everything — adds overhead for small chunks that don't save meaningful loading time, Not providing loading UI — users see a blank flash while the chunk loads 5. Best practices and production tips