为什么React应用无法在Internet Explorer浏览器中运行

问题描述 投票:0回答:1

React App根本无法在Internet Explorer中运行,我已针对此问题使用了多种解决方案,但没有任何解决方案。

  1. npm我react-app-polyfill --save
  2. 在index.js中添加以下文件

    import'react-app-polyfill / ie9';导入'react-app-polyfill / ie11';导入“ react-app-polyfill / stable”;

  3. 在package.json中,将“ ie 11”添加到“浏览器列表->开发”部分:

*

"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"ie 11",
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
  1. 删除node_modules中的.cache
  2. npm开始

预先感谢

reactjs internet-explorer webpack create-react-app polyfills
1个回答
0
投票

请打开package.json文件,并检查您是否使用的是“ react-scripts”:“ 3.3.0”或更高版本?

[我已经看到当今许多用户都遇到类似的问题。

如果您使用的是“ react-scripts”:“ 3.3.0”或更高版本,请尝试使用“ react-scripts”:“ 3.2.0”。它可以帮助解决此问题。

在进行此更改后,尝试清除node_modules / .cache。

参考:

  1. Default create-react-app does not work in IE despite polyfills and browser list

  2. “react-app-polyfill” doesn't work in IE11

  3. IE11 support doesn't work in dev mode, even after adding all polyfills and enabling ie11 support #8197

  4. Why application created using create-react-app is not working in IE browser? #8195

© www.soinside.com 2019 - 2024. All rights reserved.