Quick Summary:

The Node.js team and community always break barriers worldwide with their latest features and updates, following the same tradition and with the bang-on success of Node 19. The Node.js community is back with the latest version of Node.js 20. In this blog post, we have covered What’s New in Node 20 features and updates. In addition, we have compiled information regarding the changes that Node 20 has introduced for both the developer community and business owners. We have also outlined the upgrades in the current Node 19 following the release of Node v20.

Table of Contents

Introduction

Node.js 20 is here with its latest features and new updates taking the developer community to another level of excitement. This time the development team at Node has kept the Node 20 release date on April 18, 2023. As the Node community follows the event conventions, Node.js 20 will be promoted to Long-Term Support or LTS version in October 2023. and will be supported until April 2026. But, considering What’s New in Node 20 Features and Updates, let us move ahead to learn more.

What's New in Node 20 Features and Updates

The latest Node version 20 has come up with a number of upgrades and features from the previous version in terms of performance, error handling, and many more. Let us present all these latest features and updates of Node.js 20 in detail:

🟠 Node.js Permission Model

The Permission Model feature is furnished to Node.js v20 by Rafael Gonzaga. It is an experimental mechanism introduced to enable developers to restrict access to specific resources, such as file child process spawning, system operations, and worker thread creation, simultaneously with their program running.

To access this feature, the developers must enable the –experimental-permission, which will restrict access to all the available permissions. With this feature, developers can avoid unwanted access or alteration of sensitive data or the execution of harmful code in their applications.

To learn more about the Permission Model, check out the Node.js documentation.

🟠 Custom ESM Loader Hooks are More Stable

The Custom hooks supplied via loaders (–experimental-loader=./foo.mjs) now have a dedicated thread to run, separated from the main thread delivering a different scope for loaders and ensuring no cross-contamination between loaders and application codes.

🟠 Synchronous import.meta.resolve()

Aligning with the browser behavior, the import.meta.resolve function now returns synchronously. However, the users can still define their loader resolve hooks as asynchronous or synchronous functions based on their preference. Even if there are async resolve hooks loaded, the import.meta.resolve will still return synchronously in the application code.

🟠 V8 Upgraded To 11.3

With the contribution of Michaël Zasso, a new version of the V8 engine is included in the Node.js 20. Here, the V8 engine is updated to version 11.3, a part of Chromium 113 that brings performance enhancements and new language features such as:

  • WebAssembly Tail Call
  • RegExp v flag with set notation + properties of strings
  • Resizable ArrayBuffer and growable SharedArrayBuffer
  • String.prototype.isWellFormed and toWellFormed
  • Methods that change Array and TypedArray by copy

🟠 Stable Test Runner

In Node.js version 19, the test_runner modules were experimental, but Colin Ihrig’s contribution is now in the latest Node.js version 20, updated and marked as stable. Hence, it is ready for production use. Still, some parts need stability, including reporters and code coverage.

🟠 Performance Enhancements

The Node.js team has brought some exceptional performance enhancements with the new version of NodeJS. The newly formed Node.js Performance team has focused on performance enhancements since the last major release. Also, Node.js 20 has brought about several refinements to the fundamental parts of the runtime, including URL, fetch(), and EventTarget.

The cost to initiate Even Target is reduced to half, along with faster access to all subsystems using it. Also, the V8 Fast API calls offer improved performance in APIs such as URL.canParse() and timers.

🟠 Ada 2.0 Included in Node.js v20

With the contribution of Yagiz Nizipli and Daniel Lemire, the latest version of the URL parser written in C++, Ada has been included in Node.js v20 resulting in significant improvements in URL parsing performance. The upgrade in node:url enhances the url.domainToASCII and url.domainToUnicode functions. The latest Ada 2.0 integration in Node.js 20 across all aspects of the Node.js application ensures better performance than its previous version, Ada 1.0.4, and eliminates the ICU prerequisite in URL hostname parsing.

Are you looking for industry experts to help scale your Node.js application or create a new one from scratch?
Hire Node.js Developers from Bacancy and get ahead of the competition. Today!

🟠 Preparing SEAs Now Requires Injecting a Blob

The Node js team has been working on support for SEAs or the Single Executable Applications over the last year, with initial support landing recently; the team continues to make this better as the feature is still experimental. However, in Node 20, building a Single Executable App now requires injecting a blob prepared by Node.js from a JSON config rather than injecting the raw JavaScript file.

Example:
sea-config.json

Copy Text
{
  "main": "hello.js",
  "output": "sea-prep.blob"
}

This writes the blob to the sea-prep.blob file.

Copy Text
$ node --experimental-sea-config sea-config.json

This injecting of blob presents the option to embed multiple co-existing resources into the SEAs.

🟠 Web Crypto API

Another great function in the Node.js 20 version is the coercion and validation of arguments of Web Crypto API functions as per their WebIDL definitions which is identical to the other implementations of the Web Crypto API and fosters interoperability. The goal here is to focus on interoperability with other JavaScript environments.

🟠 Official Support for ARM64 Windows

With the input of Stefan Stojanovic, ARM64 Windows is upgraded to tier 2 support. And thus, Node v20 now includes the ARM64 Windows binaries, which allows for native execution on the platform. Like other platforms, the Node.js download site provides access to the MSI, zip/7z packages, and executable files. Also, the CI system has undergone an upgrade to facilitate full testing on ARM64 Windows, thereby preventing any regressions and ensuring compatibility. Stefan Stojanovic was responsible for elevating ARM64 Windows to tier 2 support.

🟠 WASI Version Must Now Be Specified

The Node.js development team continues to progress on the WASI or Web Assembly System Interface implementation; though it is experimental, the command line option is not needed to enable WASI, which will make it easier to consume. As the team working dedicatedly on WASI gears up to preview2, several changes have been implemented to ensure compatibility with future versions. Also, a version option has been added when creating a new WASI() instance, added when creating a new WASI() instance, and in the 20.x release, specifying a version is mandatory as there is no default value. While this improves support for new versions, it requires updating any code that relied on the default version. The development team invites additional contributors interested in using WASI in Node.js or uvwasi, which is used outside the Node.js environment.

🟠 Deprecations and Removals

In Node.js 20 update, url.parse() has been deprecated at runtime with invalid ports, as denoted by [3bed5f11e0] – (SEMVER-MAJOR) in the codebase. This is because url.parse() permits URLs with non-numeric ports, which could lead to unexpected input and potentially facilitate hostname spoofing. To mitigate these risks, future versions of Node.js, starting from Node.js v20, will throw an error if such URLs are encountered. This aligns with the WHATWG URL API, which already follows this approach. As of Node.js 20, url.parse() will issue a warning for such URLs.

🟠 Miscellaneous

These were not it; there are several generic other features and upgrades that Node.js version 20 has brought up to the table:

  • Enhanced Performance with faster startup times.
  • Improved support for TLS 1.3 and more vital cryptography for secure communications.
  • Better TypeScript Support.
  • Better Debugging Experience.
  • Effective Error Handling.
  • To know more about the latest Node 20 features and updates, visit GitHub Node Releases or Node 20 Release Announce.

    Conclusion

    This is what the latest Node v20 version brings to the table. This blog post must have given you significant insight into the latest features and updates of Node 20. However, if you are a business owner using Node.js for your web application development and unsure if you should upgrade to the latest version of Node, then you can Hire Node js development company like Bacancy to help you gain conviction and make the right choice based on your project needs and requirements.

Need to Upgrade Your App But Don't Have the Expertise?

Connect with our experienced Node.js developers to upgrade your app to the latest version without stretching your budget and time

Upgrade Your App Now

Build Your Agile Team

Hire Skilled Developer From Us

[email protected]

Your Success Is Guaranteed !

We accelerate the release of digital product and guaranteed their success

We Use Slack, Jira & GitHub for Accurate Deployment and Effective Communication.

How Can We Help You?