Skip to content

Commit 346967b

Browse files
authored
Account for node-fetch exporting default. Fixes #122
1 parent 92d9203 commit 346967b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
function r(m){return m && m.default || m;}
12
module.exports = global.fetch = global.fetch || (
2-
typeof process=='undefined' ? (require('unfetch').default || require('unfetch')) : (function(url, opts) {
3-
return require('node-fetch')(url.replace(/^\/\//g,'https://'), opts);
3+
typeof process=='undefined' ? r(require('unfetch')) : (function(url, opts) {
4+
return r(require('node-fetch'))(url.replace(/^\/\//g,'https://'), opts);
45
})
56
);

0 commit comments

Comments
 (0)