Skip to content

Commit

Permalink
@kiwicom/fetch: disable ESM modules
Browse files Browse the repository at this point in the history
Seems like fetch is not ready for ESM, see: https://gitlab.skypicker.com/incubator/universe/issues/494

kiwicom-source-id: 2c45fcd8d8291bfc4022428910260b8f7dce1355
  • Loading branch information
Martin Zlámal authored and kiwicom-github-bot committed Jun 6, 2019
1 parent 6f0ba3a commit 4b96312
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -2,8 +2,9 @@
"name": "@kiwicom/fetch",
"private": false,
"license": "MIT",
"version": "2.4.0",
"version": "2.4.1",
"main": "src/fetchWithRetries.js",
"module": false,
"sideEffects": false,
"homepage": "https://github.com/kiwicom/fetch",
"description": "Production ready fetch function with advanced capabilities like retries with delay and request cancellation after timeout.",
Expand Down
2 changes: 1 addition & 1 deletion src/ResponseError.js
Expand Up @@ -28,4 +28,4 @@ ResponseError.prototype = Object.create(Error.prototype, {

setPrototypeOf(ResponseError, Error);

module.exports = ResponseError;
export default ResponseError;
2 changes: 1 addition & 1 deletion src/TimeoutError.js
Expand Up @@ -25,4 +25,4 @@ TimeoutError.prototype = Object.create(Error.prototype, {

setPrototypeOf(TimeoutError, Error);

module.exports = TimeoutError;
export default TimeoutError;
10 changes: 5 additions & 5 deletions src/fetch.js
@@ -1,7 +1,7 @@
// @flow

if (global.fetch) {
module.exports = global.fetch.bind(global);
} else {
module.exports = require('cross-fetch');
}
import fetch from 'cross-fetch';

// Dependency `cross-fetch` takes care of providing correct ponyfill for browsers,
// React Native and Node.js. See: https://github.com/lquixada/cross-fetch/blob/0b198e8f3a8dc7ebad8f973d4a5bce6d00719b8e/package.json#L6-L8
export default fetch;

0 comments on commit 4b96312

Please sign in to comment.