@tonconnect/isomorphic-fetch
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

@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:

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.

Package Sidebar

Install

npm i @tonconnect/isomorphic-fetch

Weekly Downloads

31,305

Version

0.0.3

License

Apache-2.0

Unpacked Size

13.9 kB

Total Files

7

Last publish

Collaborators

  • thekiba
  • oleganza
  • siandreev
  • tonconnectadmin