Node.js treats JavaScript code as CommonJS modules by default
Node.js to treat JavaScript code as ECMAScript modules via the .mjs file extension, the package.json "type" field, or the --input-type flag
Node Modules Notion
Develop Node Module
Publish ESM and CJS in a single package
A short tutorial of shipping both ESM and CJS dual formats in a single NPM package.
https://antfu.me/posts/publish-esm-and-cjs

Seonglae Cho