Next.js 12

Next.js 12 nextjs.org1 month ago in#Resources Love66

As we introduced at Next.js Conf, Next.js 12 is our largest unlock ever: Rust Compiler: ~3x quicker Fast Refresh and ~5x quicker builds Middleware (beta): Enabling complete flexibility in Next.js with code over configuration React 18 Support: Native Next.js APIs are actually supported, in addition to Suspense AVIF Support: Opt-in for 20% smaller photographs Bot-aware ISR Fallback: Optimized search engine optimization for internet crawlers Native ES Modules Support: Aligning with the standardized module machine URL Imports (alpha): Import programs from any URL, no installs required React Server Components (alpha): Try it nowadays, together with SSR streaming Update nowadays through operating npm i subsequent@newest. Faster builds and Fast Refresh with Rust compiler We need to make each and every Next.js software construct quicker for manufacturing, and get quick comments in native building. Next.js 12 contains a brand spanking new Rust compiler that takes good thing about local compilation. Our Rust compiler is constructed on SWC, an open platform for the following technology of rapid tooling. We’ve optimized bundling and compiling with ~3x quicker refresh in the community and ~5x quicker builds for manufacturing. Other enhancements and lines come with: Results from the use of the brand new Rust compiler with massive Next.js codebases. Further velocity enhancements for massive codebases: We’ve validated the Rust compiler with probably the most greatest Next.js codebases on the earth. Improved observability into efficiency: Next.js now outputs Fast Refresh timing within the console for each shopper and server compilation, together with the selection of modules and recordsdata compiled. Underlying webpack enhancements: We’ve made a large number of enhancements to webpack, together with optimizing Fast Refresh and making on-demand entries extra dependable. Compilation the use of Rust is 17x quicker than Babel and enabled through default the use of Next.js 12, changing reworking JavaScript and TypeScript recordsdata. This supposed we needed to port the Babel transformations in Next.js to Rust, together with a brand spanking new CSS parser in Rust used to put into effect the styled-jsx develop into. The new Rust compiler is backwards suitable. If you might have an current Babel configuration, you’re going to robotically be opted out. We have plans to port parsing for well-liked libraries like styled-components, emotion, and relay quickly. If you’re the use of a customized Babel setup, please proportion your configuration. You too can opt-in to the use of the Rust compiler for minification. This is 7x quicker than Terser. Minification is opt-in till it’s totally validated because it replaces multi-year infrastructure. module.exports = { swcMinify: true } On most sensible of hiring DongYoon Kang, the writer of SWC, and Maia Teegarden, a contributor to Parcel, we’re proceeding to spend money on the Rust ecosystem. If you might have revel in running with Rust, please practice to enroll in our workforce. For additional information, watch our demo from Next.js Conf. Introducing Middleware Middleware lets you use code over configuration. This offers you complete flexibility in Next.js as a result of you’ll be able to run code sooner than a request is finished. Based at the person’s incoming request, you’ll be able to adjust the reaction through rewriting, redirecting, including headers, and even streaming HTML. Middleware offers you entire flexibility within Next.js. Middleware can be utilized for anything else that stocks common sense for a collection of pages,  » Read More

Like to keep reading?

This article first appeared on If you'd like to keep reading, follow the white rabbit.

View Full Article

Leave a Reply