JavaScript runtime Node.js 23 revises module and test support

The current major version of the JavaScript runtime improves performance and includes native ES module support.

listen Print view
Javascript lettering on a monitor

(Image: Trismegist san/Shutterstock.com)

2 min. read
Contents

The open source JavaScript runtime Node.js has reached version 23. The most important new features include the standard activation of require(esm) for Node.js applications, remote support for 32-bit Windows systems, stabilization of the node --run command and a revised test runner, including support for glob patterns for coverage files.

In Node.js 23, support for require(esm) is enabled by default. This function, which was previously only available with the command line flag --experimental-require-module in versions 20.x and 22.x, enables the loading of native ES modules with require(). It is currently still considered experimental. The development team is asking for user feedback in order to make final adjustments before finalization.

The first time a native ES module appears in require(), an experimental warning is displayed. In the event of problems or regressions, users can report this in the Node.js issue tracker. The function can be temporarily deactivated using --no-experimental-require-module. The complete implementation without the flag is expected to take place in a later minor version after Node.js 22 has been upgraded to the LTS version.

Videos by heise

With require(esm) enabled, Node.js no longer triggers the error ERR_REQUIRE_ESM when require() is used to load an ES module. However, there is a possibility that the error ERR_REQUIRE_ASYNC_MODULE will occur if the module or its dependencies contain a top-level await. Successfully loaded ES modules return a namespace object that can be checked with util.isModuleNamespaceObject().

Users can use process.features.require_module to check whether the function is activated in the current Node.js instance. For packages, the "module-sync" export condition allows both require() and import to load the same native ES module. Further information can be found in the documentation.

JavaScript conference enterJS

(Image: WD Ashari / Shutterstock.com)

The enterJS 2025 enterprise JavaScript conference will take place in Mannheim on May 7 and 8. The organizers dpunkt.verlag and iX are looking for proposals for presentations and workshops. Developers can participate in the Call for Proposals until November 8, 2024.

Blind-bird tickets are already available – for a discounted ticket until the program goes online.

Node.js 23 will replace Node.js 22 as the current release line as soon as Node.js 22 enters long-term support (LTS) later in October. According to the release plan, Node.js 23 will be listed as a current version for the next six months, until April 2025.

Further details on Node.js 23 can be found in the release notes.

(mdo)

Don't miss any news – follow us on Facebook, LinkedIn or Mastodon.

This article was originally published in German. It was translated with technical assistance and editorially reviewed before publication.