React: Create React App not working in Internet explorer

React: Create React App not working in Internet explorer

I faced this issue today. When I created a new react application using CRA. It was not working in internet explorer browser. I solved it by using polyfills. I followed below steps


1. installed react-app-polyfill

yarn add react-app-polyfill --save


2. imported it in index.js (should be first line)

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

3. Updated browsers in package.json
"browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "ie 11",
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
4. Deleted node_modules 
5 yarn and yarn start. Worked !!!



No comments:

Post a Comment