Having trouble with import from node-fetch? How do I properly set it up in my project?

18 Replies, 995 Views

Yo, thanks for all the replies! I tried adding `"type": "module"` to my package.json and switched to `import fetch from 'node-fetch'`, and it worked! I didn’t realize Node 16 was so picky about ESM.

Quick follow-up though: if I downgrade to node-fetch v2, will I lose any features? I’m kinda curious if it’s worth sticking with v3 or just switching to axios like someone suggested. Thanks again, y’all are lifesavers!

Messages In This Thread



Users browsing this thread: 1 Guest(s)