Missing reportWebVitals export silently breaks LCP tracking in Next.js production
Next.js only collects Core Web Vitals such as LCP in production when the app explicitly exports a reportWebVitals function (Pages Router) or uses the useReportWebVitals hook (App Router). Without this export, no metrics are forwarded to analytics services like Vercel's dashboard or Google Analytics, leaving the data columns blank. The issue goes unnoticed in development because the dev overlay injects its own logger, masking the missing pipeline. Next.js internally checks for the export after the production bundle is built, meaning hot-module replacement in dev mode cannot reveal the problem. The fix requires adding or correcting the reportWebVitals export in pages/_app.js and rebuilding the application — there is no next.config.js flag to enable this behaviour.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in