Search code examples
reactjspolyfillsbabel-polyfill

ReactJS: IE 10 Compatibility, Set is undefined


I am trying to get ReactJs compatible with IE 10 and have added the following import statements before any other import.

import '@babel/polyfill';
import 'core-js/es6/map';
import 'core-js/es6/set';

The import is done in the index file of my app, App.tsx.

However I am still getting the following error and am unable to resolve it.

SCRIPT5009: 'Set' is undefined

How can I resolve this issue?


Solution

  • I also run in this same issue. To solve this, you need some additional node packages in order to perform polyfills. Please, 1st install the npm package "core-js". After that, add

    import 'core-js/es/set'
    import 'core-js/es/map'
    

    If still running into issues, install this other package react-app-polyfill and add the following additional import:

    import 'react-app-polyfill/ie9'
    

    These imports must be in the root index file of your project. Hope this helps.