我正在尝试在internet explorer 11上运行我的react应用程序。
我正在使用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-dom和React之前,我已经确保了react-app-polyfill导入是顶级导入。
谢谢。
发布于 2020-07-27 15:30:49
我能够通过使用来自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上运行,它不会抛出stackoverflow错误。
v2::polyfill v3已取消,因此建议使用它而不是EDIT-
<script src="https://cdn.polyfill.io/v3/polyfill.min.js?features=default,es6"></script>https://stackoverflow.com/questions/63050091
复制相似问题