Node.js 22, the newest model of the favored JavaScript runtime, has arrived, that includes require()
help for ECMAScript modules, an improved WebSocket consumer, and an up to date model of the Google V8 JavaScript engine.
Introduced April 24, model 22 of the event-driven, asynchronous runtime may be downloaded from Nodejs.org. The discharge provides require()
help for synchronous ECMAScript module graphs beneath the flag: --experimental-require-module
. If this flag is enabled and the ES module meets a few necessities, require()
will load the requested module. Moreover, Node.js 22 contains an experimental characteristic for the execution of scripts from package deal.json
with the CLI flag: node --run <script-in-package-json>
.
Additionally included in Node.js 22 is Google’s V8 JavaScript engine launch 12.4, with options similar to WebAssembly rubbish assortment and iterator helpers. V8’s Maglev optimizing compiler now’s enabled by default on some architectures. WebSocket communications have additionally been up to date with a browser-compatible implementation enabled by default. A WebSocket consumer to Node.js is now offered with out exterior dependencies, the place beforehand this implementation was behind a flag.
Node.js 22 additionally enhances the effectivity of growing AbortSignal
situations, enhancing efficiency in fetchcode and the check runner. The excessive water mark for streams was elevated from 16KiB to 64KiB, offering a efficiency enhance at the price of barely increased reminiscence utilization.
From Node.js 22 and on, watch mode is taken into account secure. When in watch mode, modifications in watched information trigger the Node.js course of to restart. And, for sample matching, Node.js 22 provides to the node:fs
module the features glob
and globSync
. Builders can make the most of these features for matching file paths based mostly on particular patterns.
Node.js proponents suggested that with Node.js 18 going to end-of-life standing in April 2025, customers ought to begin planning an improve to Node.js variations 20 or 22.
Copyright © 2024 IDG Communications, Inc.