core-web-vitals
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCore Web Vitals 計測・診断
Core Web Vitals 测量与诊断
パフォーマンス計測と問題診断に特化。最適化パターンは を参照。
vercel-react-best-practices专注于性能测量与问题诊断。优化模式请参考 。
vercel-react-best-practices目標値
目标值
| 指標 | Good | Needs Improvement | Poor |
|---|---|---|---|
| LCP (Largest Contentful Paint) | < 2.5s | 2.5s - 4.0s | > 4.0s |
| INP (Interaction to Next Paint) | < 200ms | 200ms - 500ms | > 500ms |
| CLS (Cumulative Layout Shift) | < 0.1 | 0.1 - 0.25 | > 0.25 |
| FCP (First Contentful Paint) | < 1.8s | 1.8s - 3.0s | > 3.0s |
| TTFB (Time to First Byte) | < 800ms | 800ms - 1800ms | > 1800ms |
| 指标 | 优秀 | 需要改进 | 较差 |
|---|---|---|---|
| LCP (Largest Contentful Paint) | < 2.5s | 2.5s - 4.0s | > 4.0s |
| INP (Interaction to Next Paint) | < 200ms | 200ms - 500ms | > 500ms |
| CLS (Cumulative Layout Shift) | < 0.1 | 0.1 - 0.25 | > 0.25 |
| FCP (First Contentful Paint) | < 1.8s | 1.8s - 3.0s | > 3.0s |
| TTFB (Time to First Byte) | < 800ms | 800ms - 1800ms | > 1800ms |
計測コマンド
测量命令
Lighthouse CLI
Lighthouse CLI
bash
undefinedbash
undefinedデスクトップ
桌面端
npx lighthouse https://example.com --view --preset=desktop
npx lighthouse https://example.com --view --preset=desktop
モバイル
移动端
npx lighthouse https://example.com --view --preset=perf --emulated-form-factor=mobile
npx lighthouse https://example.com --view --preset=perf --emulated-form-factor=mobile
アクセシビリティのみ
仅检查无障碍性
npx lighthouse http://localhost:3000 --only-categories=accessibility --view
npx lighthouse http://localhost:3000 --only-categories=accessibility --view
JSON出力で詳細確認
以JSON输出查看详细信息
npx lighthouse http://localhost:3000 --output=json | jq '.audits["largest-contentful-paint"]'
undefinednpx lighthouse http://localhost:3000 --output=json | jq '.audits["largest-contentful-paint"]'
undefinedBundle Analyzer
Bundle Analyzer
bash
undefinedbash
undefinedNext.js
Next.js
npm run build
npx @next/bundle-analyzer
npm run build
npx @next/bundle-analyzer
汎用
通用
npx source-map-explorer 'dist/**/*.js'
undefinednpx source-map-explorer 'dist/**/*.js'
undefinedVercel Speed Insights
Vercel Speed Insights
bash
undefinedbash
undefinedVercelダッシュボードで確認
在Vercel控制台查看
Analytics > Speed Insights
Analytics > Speed Insights
---
---問題別診断
按问题诊断
LCP が遅い (> 2.5s)
LCP 加载缓慢 (> 2.5s)
原因特定:
bash
npx lighthouse URL --output=json | jq '.audits["largest-contentful-paint-element"]'主な原因と対策:
| 原因 | 対策 |
|---|---|
| ヒーロー画像が重い | |
| Webフォント読み込み | |
| サーバー応答遅い | キャッシュ、CDN、DB最適化 |
| render-blocking JS | 動的インポート、defer |
定位原因:
bash
npx lighthouse URL --output=json | jq '.audits["largest-contentful-paint-element"]'主要原因与解决方法:
| 原因 | 对策 |
|---|---|
| 首屏英雄图过大 | 使用 |
| Web字体加载延迟 | 使用 |
| 服务器响应缓慢 | 缓存优化、CDN加速、数据库优化 |
| 阻塞渲染的JS代码 | 动态导入、defer属性 |
INP が遅い (> 200ms)
INP 响应缓慢 (> 200ms)
原因特定:
- Chrome DevTools > Performance > Interactions
主な原因と対策:
| 原因 | 対策 |
|---|---|
| 重いイベントハンドラ | |
| 過剰な再レンダリング | React DevTools Profiler確認 |
| 長いJSタスク | タスク分割、 |
定位原因:
- Chrome DevTools > 性能 > 交互
主要原因与解决方法:
| 原因 | 对策 |
|---|---|
| 事件处理器过重 | 使用 |
| 过度重渲染 | 通过React DevTools Profiler排查 |
| JS任务执行时间过长 | 任务拆分、使用 |
CLS が高い (> 0.1)
CLS 布局偏移过大 (> 0.1)
原因特定:
bash
npx lighthouse URL --output=json | jq '.audits["layout-shift-elements"]'主な原因と対策:
| 原因 | 対策 |
|---|---|
| 画像サイズ未指定 | |
| 動的コンテンツ挿入 | スケルトンで領域確保 |
| Webフォント切り替え | |
| 広告/埋め込み | 固定サイズコンテナ |
定位原因:
bash
npx lighthouse URL --output=json | jq '.audits["layout-shift-elements"]'主要原因与解决方法:
| 原因 | 对策 |
|---|---|
| 未指定图片尺寸 | 必须设置 |
| 动态内容插入 | 使用骨架屏预留空间 |
| Web字体切换 | |
| 广告/嵌入内容 | 使用固定尺寸容器 |
FCP が遅い (> 1.8s)
FCP 首次内容绘制缓慢 (> 1.8s)
主な原因と対策:
| 原因 | 対策 |
|---|---|
| 初期HTMLが大きい | Server Components、ストリーミング |
| render-blocking CSS | Critical CSS inline |
| TTFB が遅い | サーバー最適化 |
主要原因与解决方法:
| 原因 | 对策 |
|---|---|
| 初始HTML体积过大 | 使用Server Components、流式渲染 |
| 阻塞渲染的CSS | 内联关键CSS |
| TTFB 响应缓慢 | 服务器优化 |
チェックリスト
检查清单
計測
测量
- Lighthouse モバイル/デスクトップ両方確認
- 実機でも確認(エミュレーションと差異あり)
- 本番環境で計測(開発環境は参考値)
- 同时检查Lighthouse移动端/桌面端结果
- 在真机上验证(与模拟器存在差异)
- 在生产环境中测量(开发环境仅作参考)
監視
监控
- Vercel Speed Insights 設定
- アラート閾値設定(LCP > 3s等)
- 定期レポート確認
- 配置Vercel Speed Insights
- 设置告警阈值(如LCP > 3s)
- 定期查看报告
関連スキル
相关技能
- vercel-react-best-practices: 最適化パターン(57ルール)
- ui-ux-pro-max: アクセシビリティ(WCAG コントラスト)
- vercel-react-best-practices: 优化模式(57条规则)
- ui-ux-pro-max: 无障碍性(WCAG 对比度)