Skip to content

Commit

Permalink
Switch to isomorphic-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
zpao committed Sep 30, 2015
1 parent 007bcf6 commit 3108f61
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 @@ -60,8 +60,8 @@
},
"dependencies": {
"core-js": "^1.0.0",
"promise": "^7.0.3",
"whatwg-fetch": "^0.9.0"
"isomorphic-fetch": "^2.1.1",
"promise": "^7.0.3"
},
"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 @@ -33,6 +33,6 @@ module.exports = {
_moduleMap: {
'core-js/library/es6/map': 'core-js/library/es6/map',
'promise': 'promise',
'whatwg-fetch': 'whatwg-fetch'
'isomorphic-fetch': 'isomorphic-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 3108f61

Please sign in to comment.