nodejs/node Logo

v20.17.0

nodejs/node — 1 month ago

module: support require()ing synchronous ESM graphs

This release adds require() support for synchronous ESM graphs under the flag --experimental-require-module.

If --experimental-require-module is enabled, and the ECMAScript module being loaded by require() meets the following requirements:

  • Explicitly marked as an ES module with a "type": "module" field in the closest package.json or a .mjs extension.
  • Fully synchronous (contains no top-level await).

require() will load the requested module as an ES Module, and return the module name space object. In this case it is similar to dynamic import() but is run synchronously and returns the name space object directly.

Contributed by Joyee Cheung in #51977

path: add matchesGlob method

Glob patterns can now be tested against individual paths via the path.matchesGlob(path, pattern) method.

Contributed by Aviv Keller in [#52881](https://github.co...

Continue on Github