From 88957dcdb959cffb679c30db792d8ef8d5643773 Mon Sep 17 00:00:00 2001 From: Rory Hunter Date: Mon, 12 Dec 2016 11:51:21 +0000 Subject: [PATCH] Don't assume window is defined when polyfilling Promise --- packages/react-scripts/config/polyfills.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/config/polyfills.js b/packages/react-scripts/config/polyfills.js index a1353ca3d2d..94cd0d9f1ec 100644 --- a/packages/react-scripts/config/polyfills.js +++ b/packages/react-scripts/config/polyfills.js @@ -14,7 +14,7 @@ if (typeof Promise === 'undefined') { // inconsistent state due to an error, but it gets swallowed by a Promise, // and the user has no idea what causes React's erratic future behavior. require('promise/lib/rejection-tracking').enable(); - window.Promise = require('promise/lib/es6-extensions.js'); + (typeof window !== 'undefined' ? window : global).Promise = require('promise/lib/es6-extensions.js'); } // fetch() polyfill for making API calls.