UNPKG

856 BJavaScriptView Raw
1'use strict';
2
3if (typeof Promise === 'undefined') {
4 // Rejection tracking prevents a common issue where React gets into an
5 // inconsistent state due to an error, but it gets swallowed by a Promise,
6 // and the user has no idea what causes React's erratic future behavior.
7 require('promise/lib/rejection-tracking').enable();
8 window.Promise = require('promise/lib/es6-extensions.js');
9}
10
11// fetch() polyfill for making API calls.
12require('whatwg-fetch');
13
14// Object.assign() is commonly used with React.
15// It will use the native implementation if it's present and isn't buggy.
16Object.assign = require('object-assign');
17
18// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
19// We don't polyfill it in the browser--this is user's responsibility.
20if (process.env.NODE_ENV === 'test') {
21 require('raf').polyfill(global);
22}