OpenAINext.jsJan 15, 2020, 7:37 PM

Next.js 9.2

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.2 — built-in CSS, improved chunking, and catch-all routes

Key Points

  • Built-in global CSS imports
  • Component-level CSS Modules (.module.css)
  • HTTP/2-optimized chunking reduces bundles

Summary

Next.js 9.2 (2020-01-15) adds native CSS support (global and CSS Modules), a new HTTP/2-optimized chunking strategy that reduces client bundle sizes, and catch-all dynamic routes. All changes are backwards compatible; upgrade by running npm i next@latest react@latest react-dom@latest.

Key Points

  • Built-in global CSS

    • Import global .css files from pages/_app.js (required) so styles remain global and ordering is consistent.
    • In development: hot updates. In production: CSS is concatenated into a single minified file and injected via <link>.
    • If you use @zeit/next-css or similar plugins, remove them to enable the built-in feature.
  • CSS Modules for component-level styles

    • Files named with the .module.css convention are locally scoped and can be imported anywhere (e.g. import styles from './Button.module.css' and use className={styles.error}).
    • Production builds emit code-split, minified CSS per hot execution path to minimize per-page CSS payload.
  • Improved code-splitting and chunking

    • New default chunking creates: minimal per-page chunk, framework chunk (React/ReactDOM), library chunks for deps >160kb, a commons chunk, plus shared chunks to optimize overall app size.
    • Leverages HTTP/2 to deliver many smaller chunks, reducing initial and successive navigation downloads (real-world partners saw large % reductions with no code changes).
  • Catch-all dynamic routes

    • Use [...name] syntax (e.g. pages/post/[...slug].js) to match nested paths like /post/a/b/c; the router query provides slug as an array.

Actionable notes for engineers

  • Upgrade packages as shown above to get all improvements.
  • Move global imports into pages/_app.js to avoid errors and ensure HMR.
  • Rename component-scoped CSS to .module.css to opt into CSS Modules.
  • Remove @zeit/next-css from next.config.js/package.json to avoid conflicts.
  • Expect better client-side performance out of the box; no code changes required to benefit from new chunking.

Full Translation

Translations

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

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

Next.js 9.2 の紹介

Next.js 9.2

Next.js 9.2 は、以下を含む主要な機能強化を導入します。

  • CSS のネイティブサポート — 外部の追加設定なしで CSS を直接インポートして使用できるネイティブサポート。
  • より積極的なコード分割 (aggressive code-splitting) — バンドルを細かく分割して初期読み込みを高速化します。
  • catch-all 動的ルート — 1つのページファイルで任意の数のパスをキャッチできる動的ルーティングをサポートします。
  • その他 — パフォーマンスや開発体験の改善など、ほかにも多くの改善が含まれます。