Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply 62 React and Next.js performance optimization rules from Vercel Engineering
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/bundle-defer-third-party.md
1---2title: Defer Non-Critical Third-Party Libraries3impact: MEDIUM4impactDescription: loads after hydration5tags: bundle, third-party, analytics, defer6---78## Defer Non-Critical Third-Party Libraries910Analytics, logging, and error tracking don't block user interaction. Load them after hydration.1112**Incorrect (blocks initial bundle):**1314```tsx15import { Analytics } from '@vercel/analytics/react'1617export default function RootLayout({ children }) {18return (19<html>20<body>21{children}22<Analytics />23</body>24</html>25)26}27```2829**Correct (loads after hydration):**3031```tsx32import dynamic from 'next/dynamic'3334const Analytics = dynamic(35() => import('@vercel/analytics/react').then(m => m.Analytics),36{ ssr: false }37)3839export default function RootLayout({ children }) {40return (41<html>42<body>43{children}44<Analytics />45</body>46</html>47)48}49```50