From a7d8833683217afb5999595e3e32af467ba49890 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 31 Jul 2019 14:45:37 +0200 Subject: [PATCH] fix for whatwg-fetch@3.0.0 issue in node https://github.com/github/fetch/issues/657 --- src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 565375df..235ff18b 100644 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,13 @@ import LowlevelTransportWithSharedConnections from './lowlevel/withSharedConnect import FallbackTransport from './fallback'; import WebUsbPlugin from './lowlevel/webusb'; -import 'whatwg-fetch'; +// node throw error with version 3.0.0 +// https://github.com/github/fetch/issues/657 +try { + require(`whatwg-fetch`); +} catch (e) { + // empty +} if (typeof window === `undefined`) { // eslint-disable-next-line quotes