【发布时间】:2019-10-18 15:47:15
【问题描述】:
我的 React 应用无法在 Internet Explorer 11 上运行。它在 edge 和 chrome 上运行良好。
我已经创建了很多文件,但我认为我不能尝试 npx create-react-app。(正如在其他类似问题的答案中指出的那样)
我已将它包含在我的两个 index.js 文件中,但它不起作用。
import 'react-app-polyfill/ie11';
这是我得到的错误:
我查看了链接,他们要求解决括号错误,但当我看到代码时没有问题。
这是我的 package.json 文件:
{
"name": "insurance_automation",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"config": "^3.1.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"multer": "^1.4.1",
"mysql2": "^1.6.5",
"node": "^11.15.0",
"nodemailer": "^6.2.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.0",
"react-scripts": "3.0.1",
"sequelize": "^5.8.6",
"universal-cookie": "^4.0.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"server": "nodemon server",
"dev": "concurrently \"npm run server\" \"npm start\" "
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"concurrently": "^4.1.0",
"nodemon": "^1.19.1"
}
}
【问题讨论】:
-
你有安装任何特殊的 npm 包吗?我也遇到了这个问题,在某个时间点我发现它是由错误的转译 npm 包引起的。
-
我已经包含了我的 package.json 文件,那里有任何可疑的依赖关系吗?
-
尝试参考此链接可能会帮助您了解问题,并且您可以获得有关可能解决方案的信息。参考:gitmemory.com/issue/facebook/create-react-app/6924/487331305
-
@sachinkalekar 我确实看到了该帖子,但它使用与答案相同的方法。我将尝试单独导入文件。
标签: node.js reactjs internet-explorer