angular / angular/angularfire

updating node-fetch to v3

Open
#3,051 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.8k
Forks
2.2k
Avg merge
22h 28m
Merged PRs (30d)
6

Description

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();
}
```

Contributor guide

Open the contributing guide

Research direction

Open site/src/shortcodes/includecode/fetch.js and inspect lines 17-31, which currently use node-fetch with require. Check how the latest node-fetch version is loaded alongside globalThis.fetch, then verify that fetchCode still retrieves the GitHub API response text successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
web-dev
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.