Tech

Next.js leverages Webpack 5 to speed up builds

The latest upgrade to Vercel’s Next.js framework for building React web applications accelerates builds and updates by extending the use of the Webpack 5 module bundler.

Introduced on April 28th, Next.js 10.2 uses Webpack 5 to improve the disk cache and allow the compiler to persist work between build runs. Only modified files are recompiled, significantly improving the performance of subsequent builds by up to 63%.

In Next.js 10.2, all applications that don’t use custom Webpack configurations next config.js Webpack 5 will be used automatically. Webpack5 also has advantages such as improved fast updates and long-term asset cache improvements. You can also tree-shake CommonJS to automatically remove unused code.

Other improvements in Next.js 10.2 are:

  • Next.js initialization has been improved to improve startup performance.
  • In headers, rewrites, and redirects, has Properties that match incoming cookies, headers, and query strings.
  • With support for automatic web font optimization, Next.js will automatically inline CSS at build time by default, eliminating extra round trips to fetch font declarations. This improves First Contentful Paint (FCP) and Largest Contentful Paint (LCP). With automatic web font optimization support for Google Fonts, plans are underway to expand support for other font providers. It also added control of the load strategy, font-display value. By optimizing fonts by default, developers can ship websites faster and improve Core Web Vitals.
  • For accessibility, route changes are now announced to screen readers and other assistive technologies by default.

Next.js users can run to update to version 10.2. npm i next@latest..

Copyright © 2021 IDG Communications, Inc.

Next.js leverages Webpack 5 to speed up builds

Source link Next.js leverages Webpack 5 to speed up builds

Related Articles

Back to top button