Software Alternatives & Reviews

Stop polyfilling fetch in your npm package

axios Deno
  1. 1
    Promise based HTTP client for the browser and node.js - axios/axios
    You’re putting together an npm library that involves fetching data. There are many popular packages that can help you (axios, superagent, etc.) but in the spirit of not shipping bulky/redundant JS code to the browser, and the progress which browsers and JavaScript has made over the years, you try to use the platform whenever possible.

    #Javascript UI Libraries #Developer Tools #JS Library 109 social mentions

  2. This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
    Export async function getFetch() { const globalFetch = globalThis.fetch; const isNodeEnv = typeof global !== 'undefined'; // do nothing if `fetch` exists if (globalFetch) { return globalFetch } else if (isNodeEnv) { // get node polyfill return import('node-fetch').then((d) => d.default)); } else { // get browser polyfill return import('whatwg-fetch').then((d) => d.fetch)); } } // use it like this Const fetch = await getFetch() Fetch('https://example.com').

    #Software Development #Software Development Tools #Web Development Tools 2408 social mentions

  3. 3
    A secure runtime for JavaScript and TypeScript built with V8, Rust, and Tokio.
    Pricing:
    • Open Source

    #Typescript #JavaScript #Web Development Tools 195 social mentions

Discuss: Stop polyfilling fetch in your npm package

Log in or Post with