React Component未在IE 10或11中呈现

时间:2017-11-15 10:31:18

标签: reactjs internet-explorer internet-explorer-11 internet-explorer-10 polyfills

我的反应组件在firefox,chrome和Microsoft Edge中工作正常,但是当我在IE 10或IE 11中检查它时,我得到一个空白页面。我明白它必须用polyfills做一些事情。所以我定义了polyfill函数,我的配置是否合适?我可能会缺少什么?

    'use strict';

    if (typeof Promise === 'undefined') {
  // Rejection tracking prevents a common issue where React gets into an
 // 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');
    }

    // fetch() polyfill for making API calls.
    require('whatwg-fetch');

 // Object.assign() is commonly used with React.
// It will use the native implementation if it's present and isn't buggy.
    Object.assign = require('object-assign');

0 个答案:

没有答案