gpt4 book ai didi

reactjs - "react-app-polyfill"在 IE11 中不起作用

转载 作者:行者123 更新时间:2023-12-03 16:37:20 30 4
gpt4 key购买 nike

我的 React 应用程序不适用于 IE 11。
我的客户希望该应用程序至少可以在 ie11 上运行。
所以,我必须解决这个错误。

我尝试了“react-app-polyfill”中的官方文档。但它仍然不起作用。
请帮我。

src/index.jsx

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { Provider } from 'react-redux';
import store from './store';

ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);

serviceWorker.unregister();

package.json
  "dependencies": {
...
"@types/jest": "^24.0.25",
"@types/node": "^12.12.24",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
"@types/react-redux": "^7.1.5",
"@types/react-router-dom": "^5.1.3",
"axios": "^0.19.0",
"install": "^0.13.0",
"node-sass": "^4.13.0",
"npm": "^6.13.4",
"react": "^16.12.0",
"react-app-polyfill": "^1.0.5",
"react-dom": "^16.12.0",
"react-hotkeys": "^2.0.0",
"react-redux": "^7.1.3",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.0",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-thunk": "^2.3.0",
"typescript": "^3.7.4"
},
...
"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"
]
}

最佳答案

也许问题与react-scripts version有关,您使用的是 react-scripts 3.3.0 及更高版本。你可以检查 package.json 文件来验证它。

GitHub 中有一些线程报告此错误,您可以引用它们,例如:github.com/facebook/create-react-app/issues/8197 , github.com/facebook/create-react-app/issues/8195 .

作为解决方法,您可以尝试降级 react-scripts 版本。据我所知,它仍然可以使用 react-scripts@3.2.0 .

关于reactjs - "react-app-polyfill"在 IE11 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59834690/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com