Skip to content

Commit

Permalink
fix node-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
sofisl committed Dec 11, 2024
1 parent ccf8a34 commit 896679f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion gax/esm/src/fallbackServiceStub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ export interface FallbackServiceStub {
export type FetchParametersMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';

async function getNodeFetch() {
return await import('node-fetch');
const isEsm = true;
if (isEsm) {
return await import('node-fetch');
} else {
return require('node-fetch');
}
}
export interface FetchParameters {
headers: {[key: string]: string};
Expand Down
4 changes: 2 additions & 2 deletions gax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "google-gax",
"version": "4.5.0",
"description": "Google API Extensions",
"main": "./build/cjs/src/index.cjs",
"main": "./build/esm/src/index.js",
"type": "module",
"types": "./build/cjs/src/index.d.ts",
"types": "./build/esm/src/index.d.ts",
"files": [
"build/esm",
"build/cjs",
Expand Down

0 comments on commit 896679f

Please sign in to comment.