Menu
Next.js taps Webpack 5 for faster builds

Next.js taps Webpack 5 for faster builds

Next.js 10.2 expands the use of Webpack 5 to improve disk caching, fast refresh, and tree shaking. Upgrade also improves startup performance.

Credit: Christina Morillo / GamOI

The latest upgrade of Vercel's Next.js framework for building React web applications speeds up builds and refreshes with expanded use of the Webpack 5 module bundler.

Introduced April 28, Next.js 10.2 uses Webpack 5 to improve disk caching, allowing the compiler to persist work between build runs. Because only changed files will be recompiled, performance of subsequent builds is dramatically improved, by up to 63 percent.

With Next.js 10.2, all applications that do not use a custom webpack configuration in their next config.js will automatically use Webpack 5. Webpack 5 also offers benefits including better fast refresh and improved long-term asset caching. Also, CommonJS now can be tree-shaken to automatically remove unused code.

Other improvements in Next.js 10.2 include:

  • Startup performance has been improved via better Next.js initialisation.
  • Headers, rewrites, and redirects now support a has property to match against incoming cookies, headers, and query strings.
  • Automatic web font optimisation is now supported, with Next.js by default automatically inlining CSS at build time, eliminating an extra round trip to fetch font declarations. This results in improvements to First Contentful Paint (FCP) and Largest Contentful Paint (LCP). Automatic web font optimisation now supports Google Fonts, with plans afoot to expand support to other font providers. Also planned is adding control over loading strategies and font-display values. By optimising fonts by default, developers will be able to more quickly ship websites and improve Core Web Vitals.
  • For accessibility, route changes now are announced to screen readers and other assistive technology by default.

Users of Next.js can update to version 10.2 by running npm i next@latest.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Events

Featured

Slideshows

Channel kicks 2021 into gear as After Hours returns to Auckland

Channel kicks 2021 into gear as After Hours returns to Auckland

After Hours made a welcome return to the channel social calendar with a bumper crowd of partners, distributors and vendors descending on The Pantry at Park Hyatt in Auckland to kick-start 2021.

Channel kicks 2021 into gear as After Hours returns to Auckland
The Kiwi channel gathers for the 2020 Reseller News Women in ICT Awards

The Kiwi channel gathers for the 2020 Reseller News Women in ICT Awards

Hundreds of leaders from the New Zealand IT industry gathered at the Hilton in Auckland on 17 November to celebrate the finest female talent in the Kiwi channel and recognise the winners of the Reseller News Women in ICT Awards (WIICTA) 2020.

The Kiwi channel gathers for the 2020 Reseller News Women in ICT Awards
Show Comments