For years the answer to ERR_REQUIRE_ESM was “switch to import()” or “pin the last CommonJS version”. Current Node can load synchronous ES modules from require() directly.
terminal
$ node --version v20.11.1 # too old: upgrade to 20.19+ or 22.12+
When it still fails
- The module uses top-level
await. Those cannot be loaded synchronously; useawait import(). - A bundler or test runner (older Jest, ts-node) does its own module loading and has not caught up.
Tip
Library authors: publish both builds with an exports map until your users are on 20.19+.