File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -70,11 +70,13 @@ npm i jike-sdk
7070如果使用 ESM 方式导入,需要把 ` package.json ` 的 ` type ` 设置为 ` module ` ,或将后缀名改为 ` .mjs ` 。
7171
7272``` ts
73+ // index.mjs
74+
7375// 自带 node-fetch
74- import { setApiConfig } from ' jike-sdk/node '
76+ import { setApiConfig } from ' jike-sdk'
7577
76- // 不带 node-fetch,需要自行 ployfill 或使用最新 Node.js
77- // import { api, setAccessToken, ApiClient } from 'jike-sdk'
78+ // 不带 node-fetch,需要自行 ployfill 或使用最新 Node.js,且需要自行安装 ky
79+ // import { setApiConfig } from 'jike-sdk/index '
7880
7981setApiConfig ({
8082 // ...
@@ -84,12 +86,10 @@ setApiConfig({
8486#### CJS 导入
8587
8688``` ts
87- ;(async () => {
88- const { setApiConfig } = await import (' jike-sdk/node' )
89- setApiConfig ({
90- // ...
91- })
92- })()
89+ const { setApiConfig } = require (' jike-sdk' )
90+ setApiConfig ({
91+ // ...
92+ })
9393```
9494
9595### Deno
You can’t perform that action at this time.
0 commit comments