From 346967bfe95735fa9c4f9666b6c7a39f40658ced Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Tue, 18 Feb 2020 10:33:42 -0500 Subject: [PATCH] Account for node-fetch exporting default. Fixes #122 --- packages/isomorphic-unfetch/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/isomorphic-unfetch/index.js b/packages/isomorphic-unfetch/index.js index 6ae374c..d78c3d8 100644 --- a/packages/isomorphic-unfetch/index.js +++ b/packages/isomorphic-unfetch/index.js @@ -1,5 +1,6 @@ +function r(m){return m && m.default || m;} module.exports = global.fetch = global.fetch || ( - typeof process=='undefined' ? (require('unfetch').default || require('unfetch')) : (function(url, opts) { - return require('node-fetch')(url.replace(/^\/\//g,'https://'), opts); + typeof process=='undefined' ? r(require('unfetch')) : (function(url, opts) { + return r(require('node-fetch'))(url.replace(/^\/\//g,'https://'), opts); }) );