angular / angular/angularfire

updating node-fetch to v3

未關閉
#3,051 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
7.8k
分支
2.2k
平均合併
22 小時 28 分鐘
30 天內合併 PR
6

描述

https://github.com/angular/angularfire/blob/a26676c69790b9a236dbc08504db705f983bd8fc/site/src/shortcodes/includecode/fetch.js#L17-L31
to use latest node-fetch version you would need to use import instead of require
```js
async function fetchCode(githubPath) {
const fetch = globalThis.fetch || import('node-fetch').then(mod => mod.default);
const githubApiUrl = convertToGitHubApiUrl(githubPath);
const response = await fetch(githubApiUrl);
return response.text();
}
```

貢獻指南

開啟貢獻指南

研究方向

開啟 site/src/shortcodes/includecode/fetch.js 並檢查第 17-31 行,這些行目前使用 require 引入 node-fetch。檢查最新版本的 node-fetch 如何與 globalThis.fetch 一起載入,然後驗證 fetchCode 仍能成功取得 GitHub API 的回應文字。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, node.js
領域
web-dev
Issue 類型
重構
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。