Pro tip: if you’re using a newer version of nodejs (18+), you can enable fetch globally by using:
`globalThis.fetch = require('node-fetch');`
But yeah, it’s wild that fetch in nodejs isn’t just built-in. For now, node-fetch or undici are your best bets.
Also, check out the docs for undici—it’s the future of fetch in nodejs, apparently.
---
Oh wow, thanks for all the suggestions! Didn’t realize there were so many options.
I tried node-fetch and it worked instantly, so that’s a win. But now I’m curious about undici—everyone’s saying it’s faster. Might give that a shot next.
Also, good to know Node 18+ has experimental fetch support. I’m on 16, so that explains things.
Thanks again, y’all saved me hours of headache!
`globalThis.fetch = require('node-fetch');`
But yeah, it’s wild that fetch in nodejs isn’t just built-in. For now, node-fetch or undici are your best bets.
Also, check out the docs for undici—it’s the future of fetch in nodejs, apparently.
---
Oh wow, thanks for all the suggestions! Didn’t realize there were so many options.
I tried node-fetch and it worked instantly, so that’s a win. But now I’m curious about undici—everyone’s saying it’s faster. Might give that a shot next.
Also, good to know Node 18+ has experimental fetch support. I’m on 16, so that explains things.
Thanks again, y’all saved me hours of headache!
