File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1
1
# how-to-use-cjs-module-as-esm-module-in-node.js
2
+
3
+ > CJS => ESM
4
+ ## demo
5
+
6
+ > ` ESM ` usages
7
+
8
+ ``` mjs
9
+ import NextMdx from ' @next/mdx' ; // ✅
10
+ // ...
11
+ NextMdx ()
12
+ ```
13
+ OR
14
+
15
+ ``` mjs
16
+ import * as NextMdx from ' @next/mdx' ; // ✅
17
+ // ...
18
+ NextMdx .default ()
19
+ ```
20
+
2
21
https://github.com/vercel/next.js/issues/43665#issuecomment-1340875080
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " how-to-use-cjs-module-as-esm-module-in-node" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " cjs => esm" ,
5
+ "main" : " src/index.mjs" ,
6
+ "scripts" : {
7
+ "esm" : " node ./src/index.mjs" ,
8
+ "cjs" : " node ./src/index.cjs" ,
9
+ "test" : " echo \" Error: no test specified\" && exit 1"
10
+ },
11
+ "repository" : {
12
+ "type" : " git" ,
13
+ "url" : " git+https://github.com/web-full-stack/how-to-use-cjs-module-as-esm-module-in-node.js.git"
14
+ },
15
+ "keywords" : [
16
+ " cj" ,
17
+ " esm"
18
+ ],
19
+ "author" : " xgqfrms" ,
20
+ "license" : " MIT" ,
21
+ "bugs" : {
22
+ "url" : " https://github.com/web-full-stack/how-to-use-cjs-module-as-esm-module-in-node.js/issues"
23
+ },
24
+ "homepage" : " https://github.com/web-full-stack/how-to-use-cjs-module-as-esm-module-in-node.js#readme"
25
+ }
You can’t perform that action at this time.
0 commit comments