运行 Internet Explorer 11 上的 React 应用程序导致 stackoverflow

Running React app on Internet explorer 11 results in stackoverflow

我正在尝试 运行 我的 React 应用程序在 Internet Explorer 11 上。

我正在使用 Create-React-App 并完成了文档所说的一切 -

已添加到 index.js

import "react-app-polyfill/ie11";
import "react-app-polyfill/stable";
import "fast-text-encoding/text"; //this is to bypass the arrow functions syntax errors//

在package.json

"development": [
  "ie 9",
  "ie 11",
  "last 1 chrome version",
  "last 1 firefox version",
  "last 1 safari version"
]

现在,没有语法错误,但它说

SCRIPT28: Out of stack space
0.chunk.js (174412,21)
SCRIPT2343: Stack overflow at line: 174412

SCRIPT28 可用时的堆栈跟踪 -

module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  var O, tag, result;
  return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case
  : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case
  : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback
  : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
};

/***/ }),

/***/ "./node_modules/react-app-polyfill/node_modules/core-js/internals/collection-add-all.js":
/*!**********************************************************************************************!*\
  !*** ./node_modules/react-app-polyfill/node_modules/core-js/internals/collection-add-all.js ***!
  \**********************************************************************************************/
/*! no static exports found */

我已经确保 react-app-polyfill 导入是顶级导入,在 React-dom 和 React.

之前

谢谢。

我能够通过使用来自 Polyfill.io 的 es6 polyfill cdn 而不是 react-app-polyfill 来解决这个问题。我删除了 react-app-polyfill 并在 index.html

中添加了 cdn 脚本
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,es6"></script>

现在我的应用程序可以在 IE11 上运行,并且不会抛出 Whosebug 错误。

编辑:: polyfill v3 已过期,因此推荐使用 v2 -

 <script src="https://cdn.polyfill.io/v3/polyfill.min.js?features=default,es6"></script>