【发布时间】:2019-12-27 08:58:05
【问题描述】:
我在这里看到了很多类似的问题,我已经尝试了所有方法,但我不知道为什么仍然没有显示任何内容。
npm install react-app-polyfill
我在 package.json 中的生产和开发数组中添加了“ie 11”
添加这两行
import "react-app-polyfill/ie11";import "react-app-polyfill/stable";到index.js的顶部删除 node_modules 中的 .cache 文件夹
重启应用
但在 ie 11 中仍然没有显示任何内容。
这是我的 package.json
{
"name": "firealarm",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.3",
"@testing-library/user-event": "^7.1.2",
"antd": "^3.26.2",
"axios": "^0.19.0",
"core-js": "^3.6.1",
"cors": "^2.8.5",
"jspdf": "^1.5.3",
"jspdf-autotable": "^3.2.11",
"react": "^16.12.0",
"react-app-polyfill": "^1.0.5",
"react-dom": "^16.12.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.0"
},
"scripts": {
"start": "set PORT=3006 && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
"ie 11",
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"ie 11",
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
我什至删除了 node_modules 文件夹并再次安装 npm 但仍然无法正常工作。
更新
我在 IE 11 中收到两条错误消息。
SCRIPT5022: SyntaxError
File: 0.chunk.js, Line: 176128, Column: 38
和
SCRIPT5022: The error you provided does not contain a stack trace.
File: 0.chunk.js, Line: 205780, Column: 64
.
【问题讨论】:
-
在资源管理器控制台中是否有任何错误?您是否使用 create-react-app 创建了应用程序?
-
@SuleymanSah,请检查错误,是的,我使用 create-react-app 创建。
-
Loran 你添加了任何代码还是只是尝试使用一个空的应用程序?
-
@SuleymanSah,应用程序已经完成。一路上,我测试了 chrome 及其工作。但是当我用 IE 测试时,我遇到了这个问题。
-
删除node_modules中的.cache文件夹后,是否也可以清空IE缓存重试?
标签: reactjs internet-explorer-11 create-react-app polyfills