Search code examples
reactjsinternet-explorerpolyfills

Object doesn't support property or method 'includes' on IE 11


Am using use-http package in react application with the following polyfills

  • whatwg-fetch
  • abortcontroller-polyfill
  • url-search-params-polyfill

The app also has babel configuration to handle corejs.

When I use the console, I can declare and assign an array which later I apply includes on it, works fine.

Workign includes on array

But when I run the app, I get the error Object doesn't support property or method 'includes' on IE 11. As I debug, I put a breakpoint, then I use the array which fails on on the console, and I receive the error. I have tried explicitly to use core-js package as well but still does not solve the issues. the array which throws error on includes

I do not understand the inconsistency, why when I declare an array includes works fine but when running the app, the same function does not.


Solution

  • The combination of the following three imports worked in the entry file.

    import "whatwg-fetch";
    import "abortcontroller-polyfill";
    import "core-js/stable";
    

    I still have not managed to configure this through webpack however, it solves the issue I had with IE.