1.1.0 • Published 1 year ago

@hcfy/node-fetch-polyfill v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@hcfy/node-fetch-polyfill

Global fetch polyfill based on node-fetch.

Usage

Install:

npm i @hcfy/node-fetch-polyfill

In CommonJS:

const readyPromise = require('@hcfy/node-fetch-polyfill').default

readyPromise.then(() => {
  console.log(typeof globalThis.fetch === 'function') // true
})

node-fetch is a pure ESM package, so it must be loaded in CommonJS using await import('node-fetch').

In ECMAScript module:

import '@hcfy/node-fetch-polyfill'

console.log(typeof globalThis.fetch === 'function') // true