Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 408 Bytes

File metadata and controls

37 lines (27 loc) · 408 Bytes

how-to-use-cjs-module-as-esm-module-in-node.js

CJS => ESM

dev

# yarn
$ yarn esm
$ yarn cjs
# npm
$ npm run esm
$ npm run cjs

demo

ESM usages

import NextMdx from '@next/mdx'; // ✅
// ...
NextMdx()

OR

import * as NextMdx from '@next/mdx'; // ✅
// ...
NextMdx.default()

vercel/next.js#43665 (comment)