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

Error [ERR_REQUIRE_ESM]: require() of ES Module #70

Closed
shauntrennery opened this issue Dec 28, 2021 · 2 comments · Fixed by #71
Closed

Error [ERR_REQUIRE_ESM]: require() of ES Module #70

shauntrennery opened this issue Dec 28, 2021 · 2 comments · Fixed by #71
Labels

Comments

@shauntrennery
Copy link

Getting an error when upgrading to v5

const { fetch } = require('got-fetch');

@alexghr
Copy link
Owner

alexghr commented Dec 28, 2021

Hey, that's expected unfortunately (I should've updated the readme). got v12 is a pure ESM package now and can only be imported by other ESM packages.

I had to migrate got-fetch v5 to be an ESM module because of this and any packages depending on got-fetch v5 will have to do the same thing. The got developers came up with a FAQ in this gist about pure ESM packages. Have a look there, maybe something will work for your project? Regardless, I will keep maintaining got-fetch v4 for as long as its needed.

I will update the README here to talk about ESM vs CJS and I will create a maintenance branch for got-fetch v4.

alexghr added a commit that referenced this issue Dec 28, 2021
* docs: update README with information about ESM

* ci: add maintenance branches

* ci: add @semantic-release/github

* chore: rename main.yml -> release.yml

fix #70
github-actions bot pushed a commit that referenced this issue Dec 28, 2021
## [5.0.1](v5.0.0...v5.0.1) (2021-12-28)

### Bug Fixes

* update documentation ([#71](#71)) ([50a4fff](50a4fff)), closes [#70](#70)
@github-actions
Copy link

🎉 This issue has been resolved in version 5.0.1 🎉

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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants