Skip to content

Commit

Permalink
Switch to isomorphic-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
zpao authored and skevy committed Jan 3, 2016
1 parent adc4328 commit 488e033
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"dependencies": {
"core-js": "^1.0.0",
"loose-envify": "^1.0.0",
"isomorphic-fetch": "^2.1.1",
"promise": "^7.0.3",
"ua-parser-js": "^0.7.9",
"whatwg-fetch": "^0.9.0"
"ua-parser-js": "^0.7.9"
},
"devEngines": {
"node": ">=3",
Expand Down
2 changes: 1 addition & 1 deletion scripts/babel/default-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ module.exports = {
plugins: plugins,
_moduleMap: {
'core-js/library/es6/map': 'core-js/library/es6/map',
'isomorphic-fetch': 'isomorphic-fetch',
'promise': 'promise',
'ua-parser-js': 'ua-parser-js',
'whatwg-fetch': 'whatwg-fetch',
},
};
10 changes: 8 additions & 2 deletions src/__forks__/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@

'use strict';

require('whatwg-fetch');
module.exports = self.fetch.bind(self);
// This hopefully supports the React Native case, which is already bringing along
// its own fetch polyfill. That should exist on `global`. If that doesn't exist
// then we'll try to polyfill, which might not work correctly in all environments.
if (global.fetch) {
module.exports = global.fetch.bind(global);
} else {
module.exports = require('isomorphic-fetch');
}

0 comments on commit 488e033

Please sign in to comment.