React framework Next.js 8 goes serverless for mobile web apps
So, the big news in for Next.js 8 is the support for serverless deployment! Why go serverless? Well, by splitting your application into serverless lambdas, Next.js makes it possible to dramatically improve both reliability and scalability. In general, serverless deployment allows for distributed points of failure. More importantly, it can be much more affordable on a “pay only for what you use” model.
Next.js 8 provides low-level APIs for serverless deployments. Most of the common hosting platforms have their own function signatures, so you’re going to want to add in a compatibility layer around your serverless build.
Next.js’ serverless deployments are optimized for a fast cold start with an incredibly lightweight serverless function. There are absolutely zero dependencies; they’re all included in the function bundle.
To enable serverless mode in Next.js, just add the
Other improvements for Next.js include a massive reduction in build-time memory. By optimizing the build performance and resource utilization, Next.js has managed to get up to 16 times better memory usage. Now, the memory is released much faster and processes no longer crash under high stress situations.
Speed is always an issue when dealing with web-based pages. There’s a smaller initial HTML size, with an optimized initial payload of 1.16KB. Additionally, the Next.js router makes it possible to pre-fetch pages for faster navigation. However, this does introduce some overhead and loading times might increase as well.
Developer improvements include things like improved on-demand entries, faster port listening, security improvements, API authentication and a faster static export. In particular, Next.js focuses on pre-rendering for a higher performance, with server and static rendering for an increased export of 75 pages per second on a machine with multiple CPUs.
Also, let’s be real, two of the best words in tech have got to be “backwards compatible”. All of these changes are completely backwards compatible. Thank you, Next!