
package.json, update your dev script:next.config.js:sizes prop is crucial for responsive images. It tells the browser which image size to download based on the viewport width, preventing mobile devices from downloading desktop-sized images.priority prop. This tells Next.js to preload the image, ensuring it loads as quickly as possible:fill prop with a container that has relative positioning. This maintains aspect ratio while preventing shifts.next/font module solves these problems elegantly.next/font is straightforward. Here's how to implement Google Fonts:font-display: swapfont-display: swap CSS property is automatically applied by next/font, ensuring text remains visible during font load. This prevents the dreaded invisible text problem that hurts user experience.window, document, or other browser-specific APIs. It prevents hydration mismatches and reduces the server-side bundle size.fetch requests and GET Route Handlers are no longer cached by default. This breaking change prevents unexpected stale data issues but requires you to be more intentional about caching:revalidateTag for on-demand updates:next/script component gives you fine-grained control over when and how these scripts load.beforeInteractive sparingly—only for truly critical scripts. Most analytics and tracking scripts work perfectly with afterInteractive. Chat widgets and other non-essential features should use lazyOnload.worker strategy is a game-changer for script performance. It runs scripts in a web worker, completely freeing up the main thread:Posted Jun 19, 2025
Unlock top performance in Next.js 15. Discover 7 essential speed hacks to optimize your app, satisfy Core Web Vitals, and achieve a green Lighthouse score overnight.