OpenAINext.jsFeb 5, 2018, 7:10 PM

Next.js 5: Universal Webpack, CSS Imports, Plugins and Zones

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 5: Universal Webpack, CSS Imports, Plugins and Zones

Key Points

  • Universal webpack for server + client
  • Plugin-based CSS & TypeScript support
  • Zones to compose multiple Next.js apps

Summary

Next.js 5 (published 2018-02-05) introduces a unified Webpack pipeline for both server and client, a plugin system for opt-in loaders and integrations (CSS, SASS, TypeScript, Preact, etc.), Zones for composing multiple Next.js apps under one domain, and several build/performance improvements (faster builds and better dynamic-import caching). Upgrade by running: npm i next@latest react@latest react-dom@latest

Key Points

  • Universal Webpack: the webpack decorator now receives an isServer flag so the same loader/tooling can run for server and client bundles.
  • Plugin system: use small composer plugins (e.g. next-css, next-sass, next-typescript, @zeit/next-preact) to enable loaders without modifying internals.
  • CSS imports: import .css in pages; install needed loaders as peer deps (css-loader, style-loader, postcss-loader) or use next-css to simplify configuration.
  • TypeScript: enable via ts-loader + default babel loader or use the next-typescript plugin to wire it up quickly.
  • React altlibs: easily swap runtimes (Preact, inferno, etc.) via plugins and aliasing.
  • Production sourcemaps: enable by setting config.devtool = 'source-map' when not in development.
  • Zones: compose multiple independently deployed Next.js apps under one domain using path-based routing rules and now alias (or micro-proxy / reverse proxies).
  • Performance: ~23.6% faster production builds observed on large apps; dynamic imports now use content-addressable hashes to improve cross-deploy caching.
  • Fragments/Document: continued support for customizing top-level Document for advanced server-rendered markup control.

Actionable notes

  • To migrate custom webpack configs, adapt your next.config.js webpack(config, {dev, isServer, ...}) decorator to handle isServer.
  • Prefer plugins for common loaders; add peer deps when required.
  • Test dynamic imports and deployment caching after upgrade to benefit from improved caching behavior.

Full Translation

Translations

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

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

Next.js 5: ユニバーサル Webpack、CSS インポート、プラグインとゾーン

Next.js 5 の概要

Next.js 5 は、大規模アプリケーション向けの拡張性(extensibility)と構成可能性(composability)、およびパフォーマンスの向上に重点を置いています。

主なポイント:

  • 拡張性: プラグインやカスタム設定を通じて機能を容易に追加・拡張できること。
  • 構成可能性: 大規模アプリケーションでのモジュール化や再利用がしやすい設計。
  • パフォーマンス: ビルドや実行時の最適化による高速化。

技術的な要素:

  • Universal Webpack のサポート
  • CSS インポート(CSS Imports)の改善
  • Plugins と Zones の導入/改善

これらの改善により、Next.js 5 は開発体験と実行時の両面での向上を目指しています。

Next.js 5: Universal Webpack, CSS Imports, Plugins and Zones | Next.js | DocsDigest