springboot- react application not working in internet explorer 11 and 9

落爺英雄遲暮 提交于 2019-12-08 04:11:18

问题


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.

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

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

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.


回答1:


As https://www.npmjs.com/package/react-app-polyfill suggests:

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

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

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

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"
    ]
  }


来源:https://stackoverflow.com/questions/57435567/springboot-react-application-not-working-in-internet-explorer-11-and-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!