Skip to content

Commit

Permalink
Account for node-fetch exporting default. Fixes #122
Browse files Browse the repository at this point in the history
  • Loading branch information
developit authored Feb 18, 2020
1 parent 92d9203 commit 346967b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/isomorphic-unfetch/index.js
Original file line number Diff line number Diff line change
@@ -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);
})
);

0 comments on commit 346967b

Please sign in to comment.