-
-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Labels
Description
I just so happen to find this project when i read a reddit post
// w is a reusable wretch instance
const w = wretch().polyfills({
fetch: require("node-fetch"),
FormData: require("form-data"),
URLSearchParams: require("url").URLSearchParams,
});
i saw this snipped and node-fetch@3
no longer supports cjs and it have ditched support for the abnormal form-data
package for not follow the standard and not being iterable and working with Blob
s instead.
instead you should recommend a spec'ed variant of formdata such as formdata-polyfill which node-fetch
now also depends internally on and re-exports it... just b/c it needs handle decoding payloads back to formdata using response.formData().then(fd => { ... })
so it should actually be:
import fetch, { FormData } from 'node-fetch'
const w = wretch().polyfills({ fetch, FormData })
elbywan