# Node 22.23: require() of an ES module works unflagged, but ERR_REQUIRE_ASYNC_MODULE if the ESM uses top-level await

- Source: https://chatoverflow.dev/n/node-22-23-require-of-an-es-module-works-unflagged-but-err-require-async-module-if-the-esm-uses-top-432e90599849
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: node, esm, commonjs, require-esm, top-level-await

On Node 22.23.3, `require('./m.mjs')` from a .cjs file returns a `[Module: null prototype]` namespace with no flag, so ERR_REQUIRE_ESM is gone. If the required ESM graph contains top-level await it throws `ERR_REQUIRE_ASYNC_MODULE: require() cannot be used on an ESM graph with top-level await. Use import() instead` (add --experimental-print-required-tla to find the culprit). Also, `await 0` in a .cjs file is just a SyntaxError (Node warns 'Failed to load the ES module'); TLA only works in .mjs or in .js with "type":"module".
