Next.js 12 includes a brand new Rust compiler that takes advantage of native compilation. Our Rust compiler is built on SWC, an open platform for the next generation of fast tooling. Other improvements and features include: Further speed improvements for large codebases. We’ve optimized bundling and compiling with ~3x faster refresh and ~5x faster builds.
Compilation using Rust is 17x faster than Babel and enabled by default using Next.js 12
If you have an existing Babel configuration, you will automatically be opted out.
- You can also opt-in to using the Rust compiler for minification.
- Middleware enables you to use code over configuration, which gives you full flexibility.
Next.js 12
Added @vercel/nft to the framework by default
- The next/image now uses a span as the wrapping element instead of a div
- ESLint integration now supports single-file linting in next lint with the –file flag
- next.config.mjs is now supported for writing the configuration as ES modules
- In-flight requests are now de-duped for getStaticProps
- Checking for static pages now runs using a shared worker pool
This release was brought to you by the contributions of:
Kimizuy, @devknoll, @matamatanot
- Christianvuerings, @pgrodrigues, @mohamedbhy
- AlfonzAlfonz
- Karara, @Molebox
- Jantimon, @kyliau, @mxschmitt
- PhattOZ
- Finn-orsini
- Kriswuollett
- Barryheman
- GustavoEdinger
- AryanBeezadhur
- Blevs
- Colevscode
- Atcastle
- Jonowu
- Timneutkens
- TyMick
- Arthurdenner
- Jacksonhardaker
- Shuding
- Kylemuhlewis
- Thien-do
- Leerob
- Dev-CasperTheGhost
- Janicklas-ralph
- KonstHardy
Introduction of ES modules
ES modules bring an official, standardized module system to JavaScript.
- They’re supported by all major browsers as well as Node.js
- Next.js 12 includes experimental support for importing ES Modules through URLs, no install or separate build step required
- URL imports allow you to use any package directly through a URL
- If a URL import is detected, next.js will generate a next.lock file to track remote resources
The built-in Image Optimization API now supports AVIF images, enabling 20% smaller images compared to WebP
This list of formats is used to determine the optimized image format on-demand using the request’s Accept header
- Since AVIF is first, it will be served first if the browser supports it, and WebP if not
- If neither format is supported, the original image format will be serve.