# @tonconnect/isomorphic-fetch

> This package provides `fetch` applicable in different environments (browser & NodeJS).

Latest version **0.0.3** (published 2023-11-06) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @tonconnect/isomorphic-fetch
pnpm add @tonconnect/isomorphic-fetch
yarn add @tonconnect/isomorphic-fetch
bun add @tonconnect/isomorphic-fetch
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-11-06 |
| First published | 2023-03-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 559 |
| Author | tonconnect |
| Maintainers | thekiba, oleganza, siandreev, tonconnectadmin |
| Keywords | ton-connect, Connect, EventSource, Isomorphic |

## Links

- npm: https://www.npmjs.com/package/@tonconnect/isomorphic-fetch
- Repository: https://github.com/ton-connect/sdk
- Homepage: https://github.com/ton-connect/sdk/tree/main/packages/isomorphic-fetch
- Issues: https://github.com/ton-connect/sdk/issues
- npm.io page: https://npm.io/package/@tonconnect/isomorphic-fetch

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.9

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.3 (latest) — 2023-11-06
- 0.0.2-beta.0 (beta) — 2023-11-02
- 0.0.2 — 2023-03-08

## README

# @tonconnect/isomorphic-fetch

This package provides `fetch` applicable in different environments (browser & NodeJS).

## Get started
`npm i @tonconnect/isomorphic-fetch`

## How to use
Just import the package and use global `fetch` function:

```ts
import '@tonconnect/isomorphic-fetch';

const result = await fetch('https://example.com');
```

That will work in both browser and NodeJS.

## How does it work
This package exports an empty script if bundler creates browser-compatible build.
When package is imported in NodeJS environment, it assigns an `fetch` imported from the `node-fetch` package to the `global` variable.

Note that this package doesn't provide an `fetch` polyfill for browsers which doesn't support `fetch` natively.

---
_Source: https://npm.io/package/@tonconnect/isomorphic-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
