Skip to content
Launch GitLab Knowledge Graph

Optimize bundle size with code splitting and lazy loading

Reduce initial bundle size from 800KB to under 300KB.

Actions

  • Implement React.lazy() for route-based code splitting
  • Split vendor chunks
  • Use dynamic imports for heavy components
  • Tree-shake unused dependencies
  • Analyze bundle with webpack-bundle-analyzer

Target Metrics

  • Initial bundle: < 300KB
  • First Contentful Paint: < 1.5s
  • Time to Interactive: < 3.5s