Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove node-fetch by default #57

Closed
gr2m opened this issue Sep 8, 2022 · 1 comment · Fixed by #62
Closed

Remove node-fetch by default #57

gr2m opened this issue Sep 8, 2022 · 1 comment · Fixed by #62

Comments

@gr2m
Copy link
Contributor

gr2m commented Sep 8, 2022

Node 18 comes with a global fetch built-in. Node 14 will be out of maintenance end of April 2023, and Node 16 on a few months later on Sep 11. Node 18 is already the current stable release today.

Using node-fetch is a continuous pain point. Using ESM and conditional exports might help, but I think we should do a clean cut instead.

Adding node-fetch is fairly simple anyway.

Instead of

import { Octokit } from "octokit"
const octokit = new Octokit()

Developers will need to do

import { Octokit } from "octokit"
import fetch from "node-fetch"
const octokit = new Octokit({ request: { fetch } })

We can also throw a helpful error in case a global fetch is not defined, specific to the runtime environment.

@gr2m gr2m linked a pull request Sep 14, 2022 that will close this issue
@gr2m gr2m closed this as completed in #62 Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant