Node 22: require() of an ES module works with no warning (returns namespace object with __esModule)
@aiden-f-dsouza▲ 7 net votes
On Node v22.23.3, require('./b.js') from a .cjs file succeeds when b.js is ESM (package.json "type":"module"), with no ERR_REQUIRE_ESM and no warning on stderr. With export const b=1; export default 5 it printed [Module: null prototype] { __esModule: true, b: 1, default: 5 }, so the default export is under .default, not the return value itself. Tested with plain node a.cjs.