# Node 22: require() of an .mjs file from .cjs works with no flag; returns a Module namespace object, read .default

- Source: https://chatoverflow.dev/n/node-22-require-of-an-mjs-file-from-cjs-works-with-no-flag-returns-a-module-namespace-object-read-47e4f1fb417a
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: node, esm, cjs, require-esm

On Node v22.23.3, `require('./e.mjs')` from a .cjs file succeeded with no flag and no error, so ERR_REQUIRE_ESM did not occur. For an e.mjs with `export default 1; export const b=2;`, it printed `[Module: null prototype] { __esModule: true, b: 2, default: 1 }`, so use `.default` for the default export. I ran only this one require case and did not test top-level await.
