Skip to content

Commit

Permalink
Switch isomorphic-unfetch to cross-fetch
Browse files Browse the repository at this point in the history
`isomorphic-unfetch` causes an error in the production server bundle
because of an improper import on `node-fetch`, replacing it with
`cross-fetch` fixes it.

Ref: developit/unfetch#122
  • Loading branch information
magicpalmtree committed Jan 19, 2019
1 parent 6f1da16 commit c4df018
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@slonik/migrator": "^0.1.13",
"@types/slonik": "^19.0.0",
"esm": "^3.2.25",
"isomorphic-unfetch": "^3.0.0",
"cross-fetch": "^3.0.4",
"next": "latest",
"react": "^16.10.1",
"react-dom": "^16.10.1",
Expand Down
2 changes: 1 addition & 1 deletion pages/initial-props.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextPage } from 'next';
import Link from 'next/link';
import Layout from '../components/Layout';
import fetch from 'isomorphic-unfetch';
import fetch from 'cross-fetch';

type Props = {
data: Object;
Expand Down
25 changes: 15 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
safe-buffer "^5.0.1"
sha.js "^2.4.8"

cross-fetch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.4.tgz#7bef7020207e684a7638ef5f2f698e24d9eb283c"
integrity sha512-MSHgpjQqgbT/94D4CyADeNoYh52zMkCX4pcJvPP5WqPsLFMKjr2TCMg381ox5qI0ii2dPwaLx/00477knXqXVw==
dependencies:
node-fetch "2.6.0"
whatwg-fetch "3.0.0"

crypto-browserify@^3.11.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
Expand Down Expand Up @@ -3049,14 +3057,6 @@ isobject@^3.0.0, isobject@^3.0.1:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=

isomorphic-unfetch@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/isomorphic-unfetch/-/isomorphic-unfetch-3.0.0.tgz#de6d80abde487b17de2c400a7ef9e5ecc2efb362"
integrity sha512-V0tmJSYfkKokZ5mgl0cmfQMTb7MLHsBMngTkbLY0eXvKqiVRRoZP04Ly+KhKrJfKtzC9E6Pp15Jo+bwh7Vi2XQ==
dependencies:
node-fetch "^2.2.0"
unfetch "^4.0.0"

[email protected]:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5"
Expand Down Expand Up @@ -3613,7 +3613,7 @@ next@latest:
webpack-hot-middleware "2.25.0"
webpack-sources "1.4.3"

[email protected], node-fetch@^2.2.0:
[email protected]:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
Expand Down Expand Up @@ -5688,7 +5688,7 @@ umzug@^2.2.0:
babel-runtime "^6.23.0"
bluebird "^3.5.3"

[email protected], unfetch@^4.0.0:
[email protected]:
version "4.1.0"
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.1.0.tgz#6ec2dd0de887e58a4dee83a050ded80ffc4137db"
integrity sha512-crP/n3eAPUJxZXM9T80/yv0YhkTEx2K1D3h7D1AJM6fzsWZrxdyRuLN0JH/dkZh1LNH8LxCnBzoPFCPbb2iGpg==
Expand Down Expand Up @@ -5927,6 +5927,11 @@ [email protected]:
watchpack "^1.6.0"
webpack-sources "^1.4.1"

[email protected]:
version "3.0.0"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb"
integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==

wide-align@^1.1.0:
version "1.1.3"
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457"
Expand Down

0 comments on commit c4df018

Please sign in to comment.