Node.js 22 introduces experimental support for using require to import ECMAScript Modules (ESM) into CommonJS (CJS) scripts. However, there are some key points to consider:
Conditions for Using require with ESM in Node 22:
The ESM module must be synchronous. This means it cannot contain await statements at the top level.
The ESM module should ideally be designed for both CJS and ESM environments (dual modules).