Skip to content

Commit 0276a11

Browse files
committed
feat: add npm scripts ✅
1 parent e844ca7 commit 0276a11

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
11
# 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+
221
https://github.com/vercel/next.js/issues/43665#issuecomment-1340875080

package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
}

0 commit comments

Comments
 (0)