Description
It appears that this library changes global.fetch
if the global fetch
does not exist. This causes issues with some other libraries that try to do the same thing, and also overrides the builtin fetch
now available in Node.js; in general, mutating globals from a library is not ideal. For example, this caused all fetch calls from the Oracle Cloud SDK to fail, which I have also raised an issue for. As a side note, it also assumes that the platform is Node.js.
Might I suggest using fetch-ponyfill, which provides the same cross-browser fetch polyfill but doesn't mutate the global fetch function? It requires an import, but this should be trivial to migrate to as I found only one call to fetch
in this library. Alternatively, perhaps create a local variable like const fetchFn = typeof fetch == "function" ? fetch : require("node-fetch")
and use fetchFn
instead of mutating global.fetch
.