springboot- react应用程序在Internet Explorer 11和9中不起作用

问题描述:

我的react应用无法在Internet Explorer 11上运行.在边缘和Chrome上运行正常. 当我通过Node.js连接应用程序时,react build文件夹可以正常运行IE 11和9.通过节点服务器端口可以正常运行.

My react app is not working on Internet explorer 11. It is working fine on edge and chrome. when I connect my application through Node.js, react build folder it is working fine IE 11 and 9. through node server port it is working.

现在我正在使用Spring Boot,但在IE11和9中无法正常工作. 我已经在IIS中部署了我的react应用.

now I'm using spring boot but it is not working in IE11 and 9. I have deployed my react app in IIS.

我已经通过 npx create-react-app 创建了我的应用程序.(如其他回答中针对类似问题所指出的那样)

I have created my application through npx create-react-app.( As pointed out in the other answers for similar questions)

我已经将其包含在两个index.js文件中,但是它不起作用. 并在我的应用程序 https://www.npmjs.com/package/react-应用程序填充

I have included this in both my index.js file but it does not work. and installed polyfills in my app https://www.npmjs.com/package/react-app-polyfill

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

这是我得到的错误:

This is the error that I am getting:

我查看了链接,他们也遇到了同样的错误,他尚未批准任何答案

I have looked at the links and they also faced the same error he didn't approve any answer yet React app not working in Internet Explorer 11 This is my package.json file:

{
      "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",
        "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"
      }
    }

任何人都可以帮助我解决此问题.

can anyone help me to resolve this issue.

作为 https: //www.npmjs.com/package/react-app-polyfill 建议:

如果要支持Internet Explorer 9或Internet Explorer 11,则应同时包含ie9或ie11和稳定模块

f you are supporting Internet Explorer 9 or Internet Explorer 11 you should include both the ie9 or ie11 and stable modules

在主js文件中

import react-app-polyfill的 stable 模块:

import stable module of the react-app-polyfill in your main js file:

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

ie11也应包含在您的浏览器列表中:

and ie11 should also be included to your browserslist:

  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all",
      "ie 11"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version",
      "ie 11"
    ]
  }