From d980370980dc07126fa37868db4bcea2e2aa8e01 Mon Sep 17 00:00:00 2001 From: Frank Lemanschik Date: Wed, 8 Jun 2022 21:35:45 +0200 Subject: [PATCH] Update fetch.ts Nodejs now also got fetch so i changed the logic in a way that it works with old nodejs as also the current one sideEffect reduces the need to check if we run in node which is well as this is the common folder --- src/common/fetch.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common/fetch.ts b/src/common/fetch.ts index 8f41553b04ad8..c0ca7e3baf02c 100644 --- a/src/common/fetch.ts +++ b/src/common/fetch.ts @@ -14,9 +14,7 @@ * limitations under the License. */ -import { isNode } from '../environment.js'; - /* Use the global version if we're in the browser, else load the node-fetch module. */ export const getFetch = async (): Promise => { - return isNode ? (await import('cross-fetch')).fetch : globalThis.fetch; + return globalThis.fetch || (await import('cross-fetch')).fetch; };