Skip to content

Commit

Permalink
Add config to ignore btoa dependency in browser environments (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
rekmarks authored Mar 25, 2021
1 parent e373a78 commit 423da2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "6.0.0",
"main": "./dist/block-ref.js",
"browser": {
"node-fetch": false
"node-fetch": false,
"btoa": false
},
"engines": {
"node": ">=10.0.0"
Expand Down
5 changes: 3 additions & 2 deletions src/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { createAsyncMiddleware, JsonRpcMiddleware } from 'json-rpc-engine';
import { EthereumRpcError, ethErrors } from 'eth-rpc-errors';
import btoa from 'btoa';
import { Payload, Block } from './cache-utils';

// eslint-disable-next-line node/global-require,@typescript-eslint/no-require-imports
/* eslint-disable node/global-require,@typescript-eslint/no-require-imports */
const fetch = global.fetch || require('node-fetch');
const btoa = global.btoa || require('btoa');
/* eslint-enable node/global-require,@typescript-eslint/no-require-imports */

const RETRIABLE_ERRORS: string[] = [
// ignore server overload errors
Expand Down

0 comments on commit 423da2b

Please sign in to comment.