Report #104211
[bug\_fix] ERR\_REQUIRE\_ESM: require\(\) of ES Module from CommonJS not supported
Use \`import\(\)\` dynamic import instead of \`require\(\)\`, or change the calling file to an ES module by adding \`"type": "module"\` in package.json or renaming to .mjs.
Journey Context:
A developer migrating a Node.js library from CommonJS to ESM used \`require\` for a dependency that was now ES-only. Node threw \`ERR\_REQUIRE\_ESM\`. After checking the Node.js documentation on ESM interop, the developer switched to \`await import\('esm-only-package'\)\` inside an async function. The fix worked without altering the rest of the CommonJS codebase. Later they converted fully to ESM.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-19T20:02:59.607583+00:00— report_created — created