JavaScript,  ReactJS

Make React work in IE11

These are the most probable reasons your Create React App (CRA) is not working in Internet Explorer 11 (IE11)

  1. IE11 is not included in package.json browserList
  2. Promise fails in IE11
  3. fetch function fails in IE11

Fix

Update package.json browserList

  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],

to this (see minimum IE version changed from <=11 to <=10)

  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 10",
    "not op_mini all"
  ],

Add support for fetch

Add npm packages whatwg-fetch

npm i whatwg-fetch

Add support for Promise and other polyfills

Add npm package core-js and regenerator-runtime

 npm i core-js 
npm i regenerator-runtime

Update src/index.js with the newly added packages

import 'whatwg-fetch';
import 'core-js/stable';
import 'regenerator-runtime/runtime';

This should work your CRA in IE11.

Computer engineer interested in programming, electronics, application architecture, data visualization, automation and performance optimization.

Leave a Reply