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!
require()
for ECMAScript ModulesNode.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.
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.
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.
package.json
using the CLI flag node --run
. This feature offers developers a streamlined way to manage and execute scripts, improving workflow efficiency.node --watch
feature, which reloads Node.js processes automatically upon file modifications, has reached full stability. This functionality is crucial for developers seeking efficient iterative testing and development.glob
and globSync
functions have been added to the node:fs
module, enabling developers to match file paths based on specific patterns easily.AbortSignal
instances result in significant performance boosts for APIs like fetch
and various testing tools.Release | Status | Initial Release | Active LTS Start | Maintenance Start | End-of-life |
---|---|---|---|---|---|
18.x | Maintenance | April 19, 2022 | October 25, 2022 | October 18, 2023 | April 30, 2025 |
20.x | LTS | April 18, 2023 | October 24, 2023 | October 22, 2024 | April 30, 2026 |
21.x | Maintenance | October 17, 2023 | – | April 1, 2024 | June 1, 2024 |
22.x | Current | April 23, 2024 | October 29, 2024 | October 21, 2024 | April 30, 2027 |
23.x | Pending | October 15, 2024 | – | April 1, 2025 | June 1, 2025 |
24.x | Pending | April 22, 2025 | October 28, 2025 | October 20, 2026 | April 30, 2028 |