随着 Create React App 3.0 的发布和浏览器列表的添加,添加对 IE 11 的支持是微不足道的,但如果您不知道在哪里查找,则很难找到这些步骤。文档列出了“支持的浏览器”并显示了默认的浏览器列表配置( https://facebook.github.io/create-react-app/docs/supported-browsers-features ),但这并不是您需要知道的全部。
使用生产设置检查 browserl.ist,您会发现 IE 11 的使用率仍然高于 Edge ( https://browserl.ist/?q=%3E0.2%25%2C+not+dead%2C+not+op_mini+all ) 使用默认的 CRA 3 应用程序,您将在 main.chunk.js 中收到语法错误,并在您的应用程序中收到其他错误11.
最佳答案
要停止错误并获得在 IE 11 中运行的默认 create-react-app React 应用程序:
npx create-react-app [AppName]
创建您的基本应用程序import 'react-app-polyfill/ie11';
到 index.js 的顶部 import 'react-app-polyfill/stable';
index.js 中第一行的正下方 关于internet-explorer - 我如何通过 Create React App 3.0 支持 IE 11?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55967048/