1 | // @remove-on-eject-begin
|
2 | /**
|
3 | * Copyright (c) 2015-present, Facebook, Inc.
|
4 | *
|
5 | * This source code is licensed under the MIT license found in the
|
6 | * LICENSE file in the root directory of this source tree.
|
7 | */
|
8 | // @remove-on-eject-end
|
9 | ;
|
10 |
|
11 | if (typeof Promise === 'undefined') {
|
12 | // Rejection tracking prevents a common issue where React gets into an
|
13 | // inconsistent state due to an error, but it gets swallowed by a Promise,
|
14 | // and the user has no idea what causes React's erratic future behavior.
|
15 | require('promise/lib/rejection-tracking').enable();
|
16 | window.Promise = require('promise/lib/es6-extensions.js');
|
17 | }
|
18 |
|
19 | // fetch() polyfill for making API calls.
|
20 | require('whatwg-fetch');
|
21 |
|
22 | // Object.assign() is commonly used with React.
|
23 | // It will use the native implementation if it's present and isn't buggy.
|
24 | Object.assign = require('object-assign');
|
25 |
|
26 | // In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
|
27 | // We don't polyfill it in the browser--this is user's responsibility.
|
28 | if (process.env.NODE_ENV === 'test') {
|
29 | require('raf').polyfill(global);
|
30 | }
|