From 2c79c44a92315f34efdb701f0e218ef149aa637e Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Wed, 25 Mar 2015 19:16:19 +0000 Subject: [PATCH 1/2] Fix module exports from Webpack / Browserify In Webpack / Browserify, require('isomorphic-fetch') returned an empty object because the whatwg-fetch polyfill only installs fetch() on the global object. Also correct URLs in package.json Fixes #16 --- npm-client.js | 7 ++++++- package.json | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/npm-client.js b/npm-client.js index 48d1742..d3e7d59 100644 --- a/npm-client.js +++ b/npm-client.js @@ -1 +1,6 @@ -module.exports = require('whatwg-fetch'); +// the whatwg-fetch polyfill installs the fetch() function +// on the global object (window or self) +// +// Return that as the export for use in Webpack, Browserify etc. +require('whatwg-fetch'); +module.exports = self.fetch; diff --git a/package.json b/package.json index bd62e20..2960e44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "isomorphic-fetch", - "version": "0.0.0", + "version": "1.0.0", "description": "Isomorphic WHATWG Fetch API, for Node & Browserify", "browser": "npm-client.js", "main": "server.js", @@ -10,14 +10,14 @@ }, "repository": { "type": "git", - "url": "git://github.com/matthew-andrews/node-fetch.git" + "url": "https://github.com/matthew-andrews/isomorphic-fetch.git" }, "author": "Matt Andrews ", "license": "MIT", "bugs": { - "url": "https://github.com/matthew-andrews/node-fetch/issues" + "url": "https://github.com/matthew-andrews/isomorphic-fetch/issues" }, - "homepage": "https://github.com/matthew-andrews/node-fetch", + "homepage": "https://github.com/matthew-andrews/isomorphic-fetch/issues", "dependencies": { "node-fetch": "^1.0.1", "whatwg-fetch": "matthew-andrews/fetch#ie9" From 99ba3b16e5004ab3e05d85c28c49c16afa9998b7 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Sat, 4 Apr 2015 22:37:36 +0100 Subject: [PATCH 2/2] Revert version number change in package.json Version numbers for this package are taken from Git tags instead. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2960e44..4a02dd6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "isomorphic-fetch", - "version": "1.0.0", + "version": "0.0.0", "description": "Isomorphic WHATWG Fetch API, for Node & Browserify", "browser": "npm-client.js", "main": "server.js",