Search code examples
internet-explorer-11create-react-app

How to make React app created by create-react-app support IE11


I have a simple react app created by the latest version of create-react-app (that only support node version 14+). I am trying to make this app run in IE11. So as recommended, I did following:

  • installed react-app-polyfill
  • added two imports at the beginning of index.js: import "react-app-polyfill/ie11", import "react-app-polyfill/stable"
  • added "ie 11" under the development in the package.json

I installed a chrome extension, IE Tab, and tested there. But still not working, I see following error when I open the chrome devtool: IE: Error: Object doesn't support property or method 'endsWith'. Source: http://localhost:3000/static/js/bundle.js:63700

Can anyone help?


Solution

  • I can reproduce the issue. You can add a polyfill for endsWith() so that it can work well in IE 11.

    You can include the polyfill within <script> tag in index.html.

    enter image description here