Skip to content

Commit

Permalink
fix: repair fetch utility for browser environments (#1293)
Browse files Browse the repository at this point in the history
* fix: limit fetch dependencies to patch versions

* fix: bind window in fetch utility for browser environments
  • Loading branch information
penovicp authored Jan 7, 2025
1 parent e8db599 commit 2cb1332
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
"@scure/base": "1.2.1",
"@scure/starknet": "1.1.0",
"abi-wan-kanabi": "^2.2.3",
"fetch-cookie": "^3.0.0",
"isomorphic-fetch": "^3.0.0",
"fetch-cookie": "~3.0.0",
"isomorphic-fetch": "~3.0.0",
"lossless-json": "^4.0.1",
"pako": "^2.0.4",
"starknet-types-07": "npm:@starknet-io/types-js@^0.7.10",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/fetchPonyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import isomorphicFetch from 'isomorphic-fetch';
import { IS_BROWSER } from './encode';
import { isUndefined } from './typed';

export default (IS_BROWSER && window.fetch) || // use built-in fetch in browser if available
export default (IS_BROWSER && window.fetch.bind(window)) || // use built-in fetch in browser if available
(!isUndefined(global) && makeFetchCookie(global.fetch)) || // use built-in fetch in node, react-native and service worker if available
isomorphicFetch; // ponyfill fetch in node and browsers that don't have it

0 comments on commit 2cb1332

Please sign in to comment.