got: Error when migrating to ESM version

Describe the bug

I’m upgrading from v12 to v14 and getting an error that sounds ESM related

  • Node.js version: 22.1.0
  • OS & version: macOS 14.5

Actual behavior

Uncaught TypeError: Class extends value #<Object> is not a constructor or null
    at node_modules/keyv/src/index.js (index.js:37:1)
    at __require2 (chunk-ZDU32GKS.js?v=ae90ae8d:19:50)
    at index.ts:10:18

Looking at the stack trace suggests that it might come from cachable-request which got uses version 10.2.14 of. There is v12 these days and v11 mentions updates for modern node versions, so maybe that’s already it? https://github.com/jaredwray/cacheable/releases/tag/v11.0.0

Electron-2024-05-15-03 05 17

Expected behavior

No error …

Code to reproduce

...

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

@Stanzilla - https://www.npmjs.com/package/cacheable-request has been released with Keyv v5. 🎉 The major change is that you can no longer pass the uri as a string.

@Stanzilla - we are planning that this will be released this month. Just FYI. @sindresorhus this could be a bit breaking as we no longer support the uri being passed.

@Stanzilla - it is released and we are working on updating all of our systems. This is a breaking change so might take a bit to get it updated and live in cacheable-request

@Stanzilla you can try it now. It will be fully released in the next couple weeks

@Stanzilla - it could need that as it is on kevy@next as it is part of version 5.0.0 that is not out of release candidate until end of June.