Search
Close this search box.
Nodejs22 Release 1024x538.png

What’s New in Node.js 22: Exciting Features and Updates

What’s New in Node.js 22: Exciting Features and Updates

Node.js, the powerful and popular JavaScript runtime, has released its latest version—Node.js 22. In this release, three major updates stand out: the enhanced capability to require() ECMAScript modules (ESM) within CommonJS modules, the introduction of a built-in WebSocket client, and the latest updates to the V8 JavaScript engine. Let’s explore these updates and more!

 

Main Updates for Node.js 22

Enhanced require() for ECMAScript Modules

Node.js 22 bridges the gap between CommonJS and ECMAScript modules by enabling the require() function to import ESM modules directly. The new version allows for synchronous ECMAScript modules to be require()d under the --experimental-require-module flag, which facilitates easier integration and usage of different module systems.

Native WebSocket Client

Node.js 22 introduces a native WebSocket client that streamlines the implementation of real-time web functionalities. This built-in capability eliminates the dependency on third-party libraries for WebSocket communication, making it easier to develop applications that require live data updates, such as chat apps or live notifications.

Updates to the V8 JavaScript Engine

The V8 JavaScript engine in Node.js 22 has been updated to improve performance and introduce new ECMAScript features, keeping Node.js at the forefront of JavaScript execution efficiency. The updated V8 engine now supports new features such as WebAssembly Garbage Collection, Array.fromAsync, Set methods, and iterator helpers, significantly enhancing performance and capabilities.

Other Updates

  • Enabled Maglev Compiler: Automatically enabled on compatible architectures, the Maglev Compiler enhances the execution efficiency of brief CLI programs, optimizing operations for faster, more responsive performance.
  • Direct Execution of package.json Scripts: An innovative experimental feature in Node.js 22 is the ability to execute scripts directly from the package.json using the CLI flag node --run
Scroll to Top