Node.js 22 Release Notes
The Node.js team is excited to present Node.js 22, the newest major release packed with performance improvements, new experimental features, and better developer experience. This release is currently marked as Current and will remain so for six months until it transitions into Long-Term Support (LTS) in October.
Node.js 22 introduces key updates such as require() support for ES modules,
a built-in WebSocket client, a major update to the V8 JavaScript engine, and enhancements
to core features like streams and file system utilities. These changes are designed to
boost both performance and developer productivity.
V8 JavaScript Engine Update
Node.js 22 integrates V8 version 12.4, bringing new JavaScript capabilities:
- Support for
WebAssembly Garbage Collectionfor more efficient memory management. - The new
Array.fromAsyncmethod for asynchronous array creation. - New
Setmethods for improved handling of collections. - Iterator helpers for cleaner and more efficient iteration patterns.
Maglev Compiler
The Maglev Compiler in V8 is now enabled by default on supported systems. Maglev is a new tier of JIT compiler optimized for short-lived command-line applications, providing faster startup performance compared to existing compilers.
Support for require() with ESM
A notable addition in Node.js 22 is the ability to require() synchronous ES modules
using the --experimental-require-module flag. If enabled, modules explicitly marked as
ES modules (via "type": "module" in package.json or using the
.mjs extension) and without top-level await can be loaded with require().
This feature functions similarly to dynamic import(), but executes synchronously
and directly returns the namespace object. The plan is to make this behavior the default in the future.
Running package.json Scripts
A new experimental feature allows developers to run scripts directly from
package.json using the CLI command:
node --run <script-name>
For example, node --run test executes the test script defined in
package.json. This provides a simpler and more consistent way
to execute project scripts without relying on external tooling.
Stream High Water Mark
The default High Water Mark for streams has been increased
from 16 KiB to 64 KiB. This change enhances
performance across many streaming operations by reducing overhead,
though it slightly increases memory usage. Developers working in
memory-constrained environments can still customize this value
using setDefaultHighWaterMark.
Watch Mode
Watch Mode (node --watch) is now stable in Node.js 22.
With watch mode enabled, any changes made to watched files automatically restart the process,
making it easier to iterate quickly during development.
WebSocket Client
Node.js now includes a WebSocket client out-of-the-box,
which was previously only available under the --experimental-websocket flag.
This built-in client is compatible with browser WebSocket APIs and eliminates the need
for external dependencies, making real-time communication simpler and faster to implement.
glob and globSync
The node:fs module now provides glob and globSync functions
for file pattern matching. Developers can use these functions to easily locate and work
with groups of files that follow specified patterns, simplifying workflows
for file system operations.
AbortSignal Performance
Node.js 22 significantly improves the performance of creating AbortSignal instances.
This leads to faster execution in APIs such as fetch and the built-in test runner,
reducing overhead in applications that rely heavily on asynchronous control flows.
Conclusion
The release of Node.js 22 marks an important step forward for developers working with modern JavaScript and server-side applications. By integrating powerful updates like the V8 12.4 engine, Maglev compiler, a built-in WebSocket client, and new require() support for ES modules, this version offers both improved performance and a smoother developer experience.
Features such as node --run for package.json scripts, stable --watch mode,
larger stream buffer defaults, and new file matching utilities (glob and globSync)
make Node.js 22 more productive and user-friendly. These updates not only simplify workflows but also
help developers build scalable and efficient applications faster.
As Node.js 22 transitions into Long-Term Support (LTS) later this year, it becomes a reliable foundation for production systems. Whether you are building real-time applications with WebSockets, command-line tools, or enterprise-grade services, Node.js 22 provides the stability, performance, and modern JavaScript features you need to succeed.