mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-02-13 13:55:42 +01:00
- Fix syntax errors in skills markdown files (.github/skills, .opencode/skills) - Change typescript to tsx for code blocks with JSX - Replace ellipsis (...) in array examples with valid syntax - Separate CSS from TypeScript into distinct code blocks - Convert JavaScript object examples to valid JSON in docs - Fix enum definitions with proper comma separation
49 lines
924 B
Markdown
49 lines
924 B
Markdown
---
|
|
title: Defer Non-Critical Third-Party Libraries
|
|
impact: MEDIUM
|
|
impactDescription: loads after hydration
|
|
tags: bundle, third-party, analytics, defer
|
|
---
|
|
|
|
## Defer Non-Critical Third-Party Libraries
|
|
|
|
Analytics, logging, and error tracking don't block user interaction. Load them after hydration.
|
|
|
|
**Incorrect (blocks initial bundle):**
|
|
|
|
```tsx
|
|
import { Analytics } from "@vercel/analytics/react";
|
|
|
|
export default function RootLayout({ children }) {
|
|
return (
|
|
<html>
|
|
<body>
|
|
{children}
|
|
<Analytics />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
```
|
|
|
|
**Correct (loads after hydration):**
|
|
|
|
```tsx
|
|
import dynamic from "next/dynamic";
|
|
|
|
const Analytics = dynamic(() => import("@vercel/analytics/react").then((m) => m.Analytics), {
|
|
ssr: false,
|
|
});
|
|
|
|
export default function RootLayout({ children }) {
|
|
return (
|
|
<html>
|
|
<body>
|
|
{children}
|
|
<Analytics />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
```
|