Node.js treats JavaScript code as CommonJS modules by defaultNode.js to treat JavaScript code as ECMAScript modules via the .mjs file extension, the package.json "type" field, or the --input-type flagNode Modules NotionNode Module Systempackage.json.npmrcnode_modulesNode built in ModuleMeta Node Module Develop Node ModulePublish ESM and CJS in a single packageA short tutorial of shipping both ESM and CJS dual formats in a single NPM package.https://antfu.me/posts/publish-esm-and-cjs