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