Node.js 22 arrives, helps ECMAScript modules


Node.js 22, the newest model of the favored JavaScript runtime has arrived, that includes require() assist for ECMAScript modules, an improved WebSocket consumer, and an up to date model of the Google JavaScript Engine V8.

Introduced April 24model 22 of the event-driven asynchronous runtime may be downloaded from The assertion provides require() assist for synchronous ECMAScript module graphics underneath 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 function for working scripts from bundle.json with CLI flag: node --run <script-in-package-json>.

Additionally included in Node.js 22 is model 12.4 of Google’s V8 JavaScript engine, with options like WebAssembly rubbish assortment and iterator helpers. V8 Maglev Optimization Compiler It’s now enabled by default on some architectures. WebSocket communications have additionally been up to date with a browser-friendly implementation enabled by default. A WebSocket consumer is now offered for Node.js with out exterior dependencies, whereas beforehand this implementation was behind a flag.

Node.js 22 additionally improves growth effectivity AbortSignal cases, enhancing efficiency in fetchcode and the take a look at runner. The excessive water mark for streams has been elevated from 16 KB to 64 KB, offering a efficiency increase at the price of barely larger reminiscence utilization.

As of Node.js 22, watchdog mode is taken into account steady. When in watch mode, adjustments to watched recordsdata trigger the Node.js course of to restart. And, for sample matching, Node.js 22 provides to the node:fs modulate capabilities glob and globSync. Builders can use these capabilities to match file paths primarily based on particular patterns.

Node.js advocates warned that with Node.js 18 Upon reaching end-of-life standing in April 2025, customers ought to start planning an improve to Node.js releases. twenty or 22.

Copyright © 2024 IDG Communications, Inc.

Supply hyperlink

Leave a Comment