我在这里看到了很多类似的问题,我已经尝试过所有的方法,但我不知道为什么仍然没有展示任何东西。
import "react-app-polyfill/ie11"; import "react-app-polyfill/stable";添加到index.js的顶部。但还是没有在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,但仍然无法工作。
更新
我在IE11中收到了两条错误消息。
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。
发布于 2019-12-31 06:55:38
发布于 2020-01-23 03:23:26
转到> /node_modules/react-dev-utils/webpackHotDevClient.js:60;添加斜杠:真
下面是代码示例
{
// Connect to WebpackDevServer via a socket.
var connection = new WebSocket(
url.format({
protocol: window.location.protocol === 'https:' ? 'wss' : 'ws',
hostname: window.location.hostname,
port: window.location.port,
//Hardcoded in WebpackDevServer
pathname: '/sockjs-node',
slashes: true,
})
);
}发布于 2019-12-30 05:47:54
我刚刚在边缘浏览器上进行了测试,npm start给出了您刚才提到的错误,但是您说您只是想在ie11上运行您的应用程序。我做了npm run build,并通过serve包(npm i -g serve之后)提供服务,它运行良好。除非你想在ie上进行开发,如果你能够在ie上运行你的应用程序,我猜会有帮助的。
https://stackoverflow.com/questions/59498274
复制相似问题