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

2.x: Specify encoding as an optional peer dependency in package.json #1310

Merged
merged 2 commits into from Nov 5, 2021

Conversation

ciffelia
Copy link

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • New feature
  • Other, please explain:

What changes did you make? (provide an overview)

I installed node-fetch 2.x on my project with Yarn 2 (aka Yarn berry). When I call require('node-fetch'), I get this warning message:

(node:22404) [MODULE_NOT_FOUND] Error: node-fetch tried to access encoding, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

It seems that encoding package is optional and only used in body.textConverted() method (discussed in #412).

So I added the following to package.json of node-fetch:

"peerDependencies": { 
    "encoding": "*"
},
"peerDependenciesMeta": {
    "encoding": {
        "optional": true
    }
}

Which issue (if any) does this pull request address?

Is there anything you'd like reviewers to know?

package.json Outdated Show resolved Hide resolved
Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
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.

Neat 👍

@github-actions
Copy link

🎉 This PR is included in version 2.6.7 🎉

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.

None yet

3 participants