Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

fetch-undici

bcomnes8.2kMIT5.0.0

Isomorphic exports of fetch from window and unduci

readme

fetch-undici

Actions Status

Isomorphic exports of fetch, providing window.fetch in the browser, and undici.fetch in node.js.

npm install fetch-undici

Usage

import {
  fetch,
  Headers,
  Response,
  Request
} from 'fetch-undici';

Why

If you want to write an API client of some kind, that would be useful in the browser or in Node.js, fetch-undici provides the best implementation of fetch for the environment it's used in.

How

fetch-undici works by utilizing environment specific exports fields so that you can have dependency injection at the built-in node module resolver layer. It supports the following export fields:

  • main (cjs node)
  • browser (cjs browser)
  • exports.node (cjs node)
  • exports.browser (esm browser)

License

MIT

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Generated by auto-changelog.

v5.0.0

Merged

  • Bump undici from 6.21.0 to 7.0.0 #89
  • Bump npm-run-all2 from 6.2.6 to 7.0.1 #88

v4.0.1 - 2024-09-25

Merged

  • Bump tap from 20.0.3 to 21.0.0 in /tests/rollup #80
  • Bump tap from 20.0.3 to 21.0.0 in /tests/esbuild #79
  • Bump tap from 20.0.3 to 21.0.0 in /tests/node #78
  • Bump tap from 19.2.5 to 20.0.0 in /tests/rollup #75
  • Bump tap from 19.2.5 to 20.0.0 in /tests/node #76
  • Bump tap from 19.2.5 to 20.0.0 in /tests/esbuild #77
  • Bump @rollup/plugin-commonjs from 25.0.8 to 26.0.1 in /tests/rollup #74
  • Bump tap from 18.8.0 to 19.0.0 in /tests/rollup #71
  • Bump tap from 18.8.0 to 19.0.0 in /tests/esbuild #72
  • Bump tap from 18.8.0 to 19.0.0 in /tests/node #73
  • Bump jsdom from 23.2.0 to 24.0.0 in /tests/rollup #70
  • Bump jsdom from 23.2.0 to 24.0.0 in /tests/esbuild #69

Fixed

  • Exclude tests from tarball #84

Commits

  • Merge pull request #85 from bcomnes/remove-tests 1852f46
  • Bump minimum undici version 8f91e92
  • Merge pull request #83 from bcomnes/dependabot/npm_and_yarn/tests/rollup/rollup/plugin-commonjs-28.0.0 b8872e1

v4.0.0 - 2023-12-07

Merged

  • Bump undici from 5.28.2 to 6.0.1 #68
  • Bump jsdom from 22.1.0 to 23.0.0 in /tests/rollup #65
  • Bump jsdom from 22.1.0 to 23.0.0 in /tests/esbuild #66

v3.0.2 - 2023-11-23

Merged

  • Bump actions/setup-node from 3 to 4 #64
  • Bump actions/checkout from 3 to 4 #45
  • Bump p-temporary-directory from 1.1.1 to 2.0.1 in /tests/rollup #43
  • Bump p-temporary-directory from 1.1.1 to 2.0.1 in /tests/esbuild #44
  • Bump @rollup/plugin-commonjs from 24.1.0 to 25.0.0 in /tests/rollup #42
  • Bump jsdom from 21.1.2 to 22.0.0 in /tests/rollup #40
  • Bump jsdom from 21.1.2 to 22.0.0 in /tests/esbuild #41
  • Bump bcomnes/npm-bump from 2.1.0 to 2.2.1 #39
  • Bump jsdom from 20.0.3 to 21.0.0 in /tests/esbuild #37
  • Bump jsdom from 20.0.3 to 21.0.0 in /tests/rollup #38
  • Bump @rollup/plugin-commonjs from 23.0.7 to 24.0.0 in /tests/rollup #36
  • Bump bcomnes/npm-bump from 2.0.2 to 2.1.0 #34
  • Bump actions/setup-node from 3.5.0 to 3.5.1 #33
  • Bump @rollup/plugin-node-resolve from 14.1.0 to 15.0.0 in /tests/rollup #32
  • Bump @rollup/plugin-commonjs from 22.0.2 to 23.0.0 in /tests/rollup #31
  • Bump actions/setup-node from 3.4.1 to 3.5.0 #30
  • Bump actions/setup-node from 3.4.0 to 3.4.1 #28
  • Bump actions/setup-node from 3.3.0 to 3.4.0 #27
  • Bump jsdom from 19.0.0 to 20.0.0 in /tests/rollup #26
  • Bump jsdom from 19.0.0 to 20.0.0 in /tests/esbuild #25
  • Bump npm-run-all2 from 5.0.2 to 6.0.0 #24
  • Bump actions/setup-node from 3.2.0 to 3.3.0 #23
  • Bump actions/setup-node from 3.1.1 to 3.2.0 #22

Commits

v3.0.1 - 2022-05-15

Merged

  • Improve node import #21

Commits

  • Use a conditional import on undici in node eceea56
  • Fix conditional export 385f0ec
  • Use updated test asserts 5bc5aa7

v3.0.0 - 2022-05-12

Merged

  • Export native fetch in node and add native boolean export #19
  • Bump standard from 16.0.4 to 17.0.0 #18
  • Bump actions/setup-node from 3.1.0 to 3.1.1 #17
  • Bump fastify/github-action-merge-dependabot from 3.0.2 to 3.1 #16
  • Bump actions/setup-node from 3.0.0 to 3.1.0 #15

Commits

  • Breaking change: Export native fetch in node and add native boolean export 58b65eb
  • Update tests.yml c4ffd4a
  • Fix test node versions 0b6684d

v2.0.0 - 2022-03-30

Merged

  • Bump undici from 4.16.0 to 5.0.0 #14
  • Bump actions/checkout from 2.4.0 to 3 #13
  • Bump actions/setup-node from 2.5.1 to 3.0.0 #12

v1.1.0 - 2022-01-27

Merged

  • Export Headers, Response, Request #11
  • Bump fastify/github-action-merge-dependabot from 2.7.1 to 3.0.2 #9
  • Bump actions/setup-node from 2.5.0 to 2.5.1 #10
  • Bump fastify/github-action-merge-dependabot from 2.7.0 to 2.7.1 #8
  • Bump fastify/github-action-merge-dependabot from 2.6.0 to 2.7.0 #7
  • Bump actions/setup-node from 2.4.1 to 2.5.0 #6
  • Bump fastify/github-action-merge-dependabot from 2.5.0 to 2.6.0 #5
  • Bump actions/checkout from 2.3.5 to 2.4.0 #4
  • Bump actions/checkout from 2.3.4 to 2.3.5 #3
  • Bump actions/setup-node from 2.4.0 to 2.4.1 #2
  • Bump fastify/github-action-merge-dependabot from 2.4.0 to 2.5.0 #1

Commits

v1.0.5 - 2021-09-09

Commits

v1.0.4 - 2021-09-08

Commits

v1.0.3 - 2021-09-06

Commits

v1.0.2 - 2021-09-06

Commits

v1.0.1 - 2021-09-06

Commits

v1.0.0 - 2021-09-06

Commits