From 5a8f4f2fbd9b30f7cc6ed2a5d3381b0fd8d4f8b6 Mon Sep 17 00:00:00 2001 From: Tony Jin Date: Tue, 30 May 2017 15:49:04 -0700 Subject: [PATCH] Chore: Use whatwg-fetch instead of isomorphic-fetch (#155) isomorphic-fetch is a wrapper around whatwg-fetch and we don't need its isomorphic nature --- build/webpack.karma.config.js | 3 +-- package.json | 4 ++-- src/lib/__tests__/util-test.js | 2 +- src/lib/annotations/AnnotationService.js | 2 +- src/lib/util.js | 2 +- yarn.lock | 6 +++++- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/build/webpack.karma.config.js b/build/webpack.karma.config.js index 148870c08..3145e3216 100644 --- a/build/webpack.karma.config.js +++ b/build/webpack.karma.config.js @@ -10,8 +10,7 @@ const config = merge(baseConfig, { devtool: 'inline-source-map', resolve: { alias: { - sinon: 'sinon/pkg/sinon', - 'isomorphic-fetch': 'fetch-mock-forwarder' + sinon: 'sinon/pkg/sinon' } } }); diff --git a/package.json b/package.json index 4ecca1d2e..748c5e77f 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "fetch-mock-forwarder": "^1.0.0", "file-loader": "^0.10.1", "i18n-webpack-plugin": "^0.3.0", - "isomorphic-fetch": "^2.2.1", "karma": "^1.5.0", "karma-chai": "^0.1.0", "karma-chai-as-promised": "^0.1.2", @@ -92,7 +91,8 @@ "stylelint-config-standard": "^16.0.0", "stylelint-order": "^0.4.1", "url-loader": "^0.5.8", - "webpack": "^2.2.1" + "webpack": "^2.2.1", + "whatwg-fetch": "^2.0.3" }, "scripts": { "build": "yarn run clean && yarn run build-rb && yarn run lint && yarn run dev", diff --git a/src/lib/__tests__/util-test.js b/src/lib/__tests__/util-test.js index e1c42778c..84b30ea56 100644 --- a/src/lib/__tests__/util-test.js +++ b/src/lib/__tests__/util-test.js @@ -1,5 +1,5 @@ /* eslint-disable no-unused-expressions */ -import 'isomorphic-fetch'; +import 'whatwg-fetch'; import fetchMock from 'fetch-mock'; import * as util from '../util'; diff --git a/src/lib/annotations/AnnotationService.js b/src/lib/annotations/AnnotationService.js index 814ceb8ab..a654e4748 100644 --- a/src/lib/annotations/AnnotationService.js +++ b/src/lib/annotations/AnnotationService.js @@ -1,5 +1,5 @@ +import 'whatwg-fetch'; import EventEmitter from 'events'; -import fetch from 'isomorphic-fetch'; import autobind from 'autobind-decorator'; import Annotation from './Annotation'; import { getHeaders } from '../util'; diff --git a/src/lib/util.js b/src/lib/util.js index 3ed2ebaf3..1a7583047 100644 --- a/src/lib/util.js +++ b/src/lib/util.js @@ -1,4 +1,4 @@ -import fetch from 'isomorphic-fetch'; +import 'whatwg-fetch'; const HEADER_CLIENT_NAME = 'X-Box-Client-Name'; const HEADER_CLIENT_VERSION = 'X-Box-Client-Version'; diff --git a/yarn.lock b/yarn.lock index 502b2e956..ad740843d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3332,7 +3332,7 @@ isobject@^2.0.0: dependencies: isarray "1.0.0" -isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.1: +isomorphic-fetch@^2.1.1: version "2.2.1" resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" dependencies: @@ -6507,6 +6507,10 @@ whatwg-fetch@>=0.10.0, whatwg-fetch@^0.10.1: version "0.10.1" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-0.10.1.tgz#365125d40b36823feac8ab41b71c4d56e84a531f" +whatwg-fetch@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84" + whet.extend@~0.9.9: version "0.9.9" resolved "https://registry.yarnpkg.com/whet.extend/-/whet.extend-0.9.9.tgz#f877d5bf648c97e5aa542fadc16d6a259b9c11a1"