{"id":550,"date":"2026-09-01T13:05:49","date_gmt":"2026-09-01T04:05:49","guid":{"rendered":"https:\/\/stratos-research.com\/?p=550"},"modified":"2026-09-01T13:05:49","modified_gmt":"2026-09-01T04:05:49","slug":"next-js-%e3%81%ae-production-%e3%83%93%e3%83%ab%e3%83%89%e3%81%a7-lcp-%e3%81%8c%e8%a8%88%e6%b8%ac%e3%81%95%e3%82%8c%e3%81%aa%e3%81%84%e5%8e%9f%e5%9b%a0%e3%81%a8%e5%af%be%e5%87%a6%e6%b3%95","status":"publish","type":"post","link":"https:\/\/stratos-research.com\/?p=550","title":{"rendered":"Next.js \u306e production \u30d3\u30eb\u30c9\u3067 LCP \u304c\u8a08\u6e2c\u3055\u308c\u306a\u3044\u539f\u56e0\u3068\u5bfe\u51e6\u6cd5"},"content":{"rendered":"<h2>\u554f\u984c\u306e\u6982\u8981<\/h2>\n<p>\u958b\u767a\u30e2\u30fc\u30c9\uff08<code>npm run dev<\/code>\uff09\u3067\u306f\u30b3\u30f3\u30bd\u30fc\u30eb\u306b LCP \u304c\u8868\u793a\u3055\u308c\u307e\u3059\u304c\u3001\u672c\u756a\u30d3\u30eb\u30c9\uff08<code>npm run build &amp;&amp; npm start<\/code>\uff09\u3084 Vercel\u30fbNetlify\u30fb\u81ea\u5df1\u30db\u30b9\u30c8\u74b0\u5883\u3078\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u3068\u3001Vercel \u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3084\u30ab\u30b9\u30bf\u30e0\u5206\u6790\u30c4\u30fc\u30eb\u306e\u300cLargest Contentful Paint\u300d\u5217\u304c\u7a7a\u767d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u539f\u56e0\uff1areportWebVitals \u306e\u672a\u5b9f\u88c5\u307e\u305f\u306f\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0<\/h2>\n<p>Next.js \u306f <code>reportWebVitals<\/code> \u95a2\u6570\uff08Pages Router\uff09\u307e\u305f\u306f <code>useReportWebVitals<\/code> \u30d5\u30c3\u30af\uff08App Router\uff09\u304c\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u524d\u63d0\u306b\u3001Core Web Vitals\uff08LCP\u3001CLS\u3001INP \u7b49\uff09\u3092\u53ce\u96c6\u3057\u307e\u3059\u3002\u3053\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u304c\u7121\u3044\u3001\u3042\u308b\u3044\u306f LCP \u3092\u9664\u5916\u3059\u308b\u30ed\u30b8\u30c3\u30af\u304c\u5165\u3063\u3066\u3044\u308b\u3068\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u3067\u53d6\u5f97\u3057\u305f\u6307\u6a19\u304c\u30b5\u30fc\u30d0\u30fc\u3078\u9001\u4fe1\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<h2>\u89e3\u6c7a\u7b56\uff1areportWebVitals \u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u306e\u8ffd\u52a0<\/h2>\n<p>pages\/_app.js\uff08\u307e\u305f\u306f App Router \u306e\u30a8\u30f3\u30c8\u30ea\uff09\u306b\u3001\u3059\u3079\u3066\u306e\u6307\u6a19\u3092\u8ee2\u9001\u3059\u308b <code>reportWebVitals<\/code> \u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3092\u5b9f\u88c5\u3057\u307e\u3059\u3002\u4f8b\u3068\u3057\u3066\uff1a<\/p>\n<pre><code>\/\/ pages\/_app.js\nexport async function reportWebVitals(metric) {\n  \/\/ \u5fc5\u8981\u306a\u3089 API \u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3078 POST\n  await fetch('\/api\/web-vitals', {method: 'POST', body: JSON.stringify(metric)});\n}\n<\/code><\/pre>\n<p>\u3053\u306e\u95a2\u6570\u306f LCP \u3092\u542b\u3080\u5168\u6307\u6a19\u3092\u7834\u68c4\u305b\u305a\u306b\u9001\u4fe1\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n<h2>\u53d7\u4fe1\u7528 API \u306e\u4f5c\u6210<\/h2>\n<p>\u4e0a\u8a18\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u304c POST \u3059\u308b <code>\/api\/web-vitals<\/code> \u30eb\u30fc\u30c8\u3092\u4f5c\u6210\u3057\u3001\u53d7\u3051\u53d6\u3063\u305f\u30da\u30a4\u30ed\u30fc\u30c9\u3092\u30ed\u30b0\u51fa\u529b\u307e\u305f\u306f\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<pre><code>\/\/ pages\/api\/web-vitals.js\nexport default function handler(req, res) {\n  if (req.method !== 'POST') return res.status(405).end();\n  const metric = req.body;\n  console.log('Web Vital received:', metric);\n  res.status(200).end();\n}\n<\/code><\/pre>\n<h2>\u52d5\u4f5c\u78ba\u8a8d\u624b\u9806<\/h2>\n<ol>\n<li>\u30ed\u30fc\u30ab\u30eb\u3067\u672c\u756a\u30d3\u30eb\u30c9\u3092\u5b9f\u884c\uff08<code>npm run build &amp;&amp; npm start<\/code>\uff09\u3002<\/li>\n<li>\u30d6\u30e9\u30a6\u30b6\u3067 <code>http:\/\/localhost:3000<\/code> \u3092\u958b\u304d\u3001DevTools \u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u306b LCP \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u51fa\u529b\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3002<\/li>\n<li>\u540c\u6642\u306b <code>\/api\/web-vitals<\/code> \u306e\u30ed\u30b0\u306b\u540c\u4e00\u30da\u30a4\u30ed\u30fc\u30c9\u304c\u5c4a\u3044\u3066\u3044\u308b\u304b\u30c1\u30a7\u30c3\u30af\u3002<\/li>\n<li>\u6570\u5206\u5f85\u3063\u3066 Vercel \u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3084\u81ea\u793e\u5206\u6790\u753b\u9762\u3067 LCP \u5217\u304c\u57cb\u307e\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3002<\/li>\n<\/ol>\n<h2>\u3088\u304f\u3042\u308b\u843d\u3068\u3057\u7a74\uff1aLCP \u304c\u9664\u5916\u3055\u308c\u308b\u30b1\u30fc\u30b9<\/h2>\n<ul>\n<li>\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u5185\u3067 <code>if (metric.name === 'LCP') return;<\/code> \u306e\u3088\u3046\u306b\u65e9\u671f\u30ea\u30bf\u30fc\u30f3\u3057\u3066\u3044\u308b\u3002<\/li>\n<li>\u7279\u5b9a\u6307\u6a19\uff08\u4f8b\uff1aCLS\uff09\u306e\u307f\u51e6\u7406\u3059\u308b\u30ed\u30b8\u30c3\u30af\u3092\u66f8\u3044\u3066\u304a\u308a\u3001\u4ed6\u306e\u6307\u6a19\u306f\u7121\u8996\u3055\u308c\u3066\u3044\u308b\u3002<\/li>\n<\/ul>\n<p>\u3053\u308c\u3089\u306e\u6761\u4ef6\u5206\u5c90\u3092\u524a\u9664\u3057\u3001\u3059\u3079\u3066\u306e <code>metric.name<\/code> \u306b\u5bfe\u3057\u3066\u9001\u4fe1\u51e6\u7406\u3092\u8d70\u3089\u305b\u307e\u3059\u3002<\/p>\n<h2>\u518d\u767a\u9632\u6b62\u7b56\uff1aCI \u3067\u306e\u30c1\u30a7\u30c3\u30af<\/h2>\n<p>ESLint \u306b\u306f <code>reportWebVitals<\/code> \u306e\u6709\u7121\u3092\u691c\u8a3c\u3059\u308b\u30eb\u30fc\u30eb\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u305d\u306e\u305f\u3081\u3001\u7c21\u6613\u7684\u306a\u30c6\u30b9\u30c8\u3092 CI \u306b\u7d44\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<pre><code>\/\/ jest.test.js\nimport '..\/pages\/_app';\ntest('reportWebVitals is exported', () =&gt; {\n  expect(typeof window.__NEXT_DATA__.reportWebVitals).toBe('function');\n});\n<\/code><\/pre>\n<p>\u30c6\u30b9\u30c8\u304c\u5931\u6557\u3059\u308c\u3070\u3001\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u304c\u524a\u9664\u3055\u308c\u305f\u3053\u3068\u304c\u5373\u5ea7\u306b\u5224\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>production \u30d3\u30eb\u30c9\u3067 LCP \u304c\u8a08\u6e2c\u3055\u308c\u306a\u3044\u4e3b\u56e0\u306f <code>reportWebVitals<\/code> \u306e\u672a\u5b9f\u88c5\u307e\u305f\u306f\u4e0d\u9069\u5207\u306a\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3067\u3059\u3002\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3092\u6b63\u3057\u304f\u8ffd\u52a0\u3057\u3001API \u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3067\u53d7\u4fe1\u3092\u78ba\u8a8d\u3059\u308c\u3070\u3001Vercel \u3084\u4efb\u610f\u306e\u5206\u6790\u30c4\u30fc\u30eb\u306b LCP \u30c7\u30fc\u30bf\u304c\u5c4a\u304f\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p class=\"source-link\">\u5143\u8a18\u4e8b: <a href=\"https:\/\/dev.to\/mahdi_benrhouma_fe1c6005\/fix-lcp-not-working-in-production-23c1\" rel=\"noopener noreferrer\">https:\/\/dev.to\/mahdi_benrhouma_fe1c6005\/fix-lcp-not-working-in-production-23c1<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u554f\u984c\u306e\u6982\u8981 \u958b\u767a\u30e2\u30fc\u30c9\uff08npm run de [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":551,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_spp_pexels_query":"","_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[2],"tags":[],"class_list":["post-550","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/stratos-research.com\/wp-content\/uploads\/2026\/09\/painted-549-W3wgXe.webp","_links":{"self":[{"href":"https:\/\/stratos-research.com\/index.php?rest_route=\/wp\/v2\/posts\/550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stratos-research.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stratos-research.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stratos-research.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/stratos-research.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=550"}],"version-history":[{"count":0,"href":"https:\/\/stratos-research.com\/index.php?rest_route=\/wp\/v2\/posts\/550\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stratos-research.com\/index.php?rest_route=\/wp\/v2\/media\/551"}],"wp:attachment":[{"href":"https:\/\/stratos-research.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stratos-research.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stratos-research.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}