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

Fix "global is not defined" #1704

Merged
merged 1 commit into from
Jan 30, 2023
Merged

Conversation

segevfiner
Copy link

Purpose

I think this was missed in #1534

Changes

Replace global -> globalObject

Additional information

I get a global is not defined error otherwise. (octokit is still using this instead of isomorphic-fetch/cross-fetch)

Copy link
Member

@LinusU LinusU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jimmywarting
Copy link
Collaborator

jimmywarting commented Jan 19, 2023

I think we should remove getGlobal and just use globalThis instead. and do we really need to use bind?

All in all:

"use strict";

const { fetch, Headers, Request, Response } = globalThis;

module.exports = exports = fetch;

// Needed for TypeScript and Webpack.
if (fetch) {
	exports.default = fetch;
}

exports.Headers = Headers;
exports.Request = Request;
exports.Response = Response;

@LinusU
Copy link
Member

LinusU commented Jan 30, 2023

@jimmywarting what do you think about releasing this PR as is, and then someone can open a new PR for further changes?

@jimmywarting
Copy link
Collaborator

sure

@jimmywarting jimmywarting merged commit 70f592d into node-fetch:2.x Jan 30, 2023
@github-actions
Copy link

🎉 This PR is included in version 2.6.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants