OpenAINext.jsJul 27, 2020, 4:23 PM

Next.js 9.5

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

Next.js 9.5: Stable ISR, basePath, rewrites, and persistent caching

Key Points

  • Stable Incremental Static Regeneration
  • Custom basePath and routing controls
  • Content-hashed page bundles for long-term caching

Summary

Next.js 9.5 (2020-07-27) adds several production-ready features that improve routing, caching, and developer experience. Highlights include Stable Incremental Static Regeneration (ISR) to update static pages in the background, a configurable basePath for serving Next.js from subpaths, first-class rewrites, redirects, and headers in next.config.js, optional trailing-slash behavior, content-hashed page bundles for long-term caching, Fast Refresh reliability improvements, a production React profiling flag, optional catch-all routes, and a beta opt-in for Webpack 5.

These changes are practical for teams migrating existing sites, optimizing cache behavior across deploys, or adopting incremental static generation at scale.

Key Points

  • Incremental Static Regeneration (stable): add revalidate in getStaticProps to re-render pages in the background (e.g. return { props, revalidate: 1 }). Pages remain served from static cache while the new version is generated.
  • basePath: host Next.js on a subpath by adding basePath: '/docs' to next.config.js. next/link and router APIs will automatically include the prefix.
  • Rewrites / Redirects / Headers: configure routing and HTTP headers in next.config.js via async rewrites(), redirects(), and headers() functions to proxy, redirect, or attach headers to static and server-rendered routes.
  • Trailing slash option: control trailing-slash behavior with trailingSlash: true or false in next.config.js to avoid needless redirects and match legacy URL conventions.
  • Persistent caching: page bundles now use deterministic content hashes instead of a global build ID, enabling long-term caching (Cache-Control: public, max-age=31536000, immutable) for unchanged pages across deploys.
  • Fast Refresh improvements: clearer, more focused error messages and more reliable live-editing during development.
  • Other: production React profiling flag for measuring render cost, optional catch-all routes for SEO-driven patterns, and an opt-in Webpack 5 beta for smaller/faster builds.

Practical upgrade notes

  • Audit custom servers or existing rewrites/redirects when upgrading to rely on next.config.js options.
  • Expect improved cache hit rates after deploys due to content-hash bundles; verify CDN/edge caching settings if you had custom cache invalidation logic.
  • Try ISR on a subset of pages using revalidate to validate behavior under your backend load patterns; consider webhooks or upcoming RFCs for multi-page invalidation.

Full Translation

Translations

A translation section that keeps the flow of the original article.

openaijamodel: gpt-5-mini-2025-08-07

Next.js 9.5

Next.js 9.5

Next.js 9.5 では、次の主要な新機能と改善が導入されました。

  • Stable Incremental Static Regeneration — インクリメンタル静的再生成の安定サポート(Stable Incremental Static Regeneration)。
  • Custom Base Path — アプリをルート以外のパスでホストするためのカスタムベースパスサポート(Custom Base Path)。
  • Redirects and Rewrites — より柔軟なルーティングを可能にするリダイレクトとリライトのサポート(Redirects and Rewrites)。
  • Webpack 5 Beta — ビルドの改善と新機能を提供する Webpack 5 のベータサポート(Webpack 5 Beta)。
  • その他多数の改善とバグ修正。

これらにより、パフォーマンス、デプロイの柔軟性、開発体験が向上します。