Support IE 11 using browserslist and babel

14,011

Should your browsers be: "last 2 versions, > 0.5%, ie >= 11"

So you force ie to be 11 or higher while all o

Share:
14,011
Mati Tucci
Author by

Mati Tucci

expert console logger

Updated on June 07, 2022

Comments

  • Mati Tucci
    Mati Tucci about 2 years

    I already have this in my .babelrc:

      presets: [
        [
          'env',
          {
            targets: {
              browsers:   'last 2 versions, > 5%'
            },
            modules:      false,
            useBuiltIns:  'entry',
            debug:        true
          }
        ]
      ]
    

    Now I want to support IE 11 too. So I added IE 11 to the browsers string. But when I test it I still see an error related to custom events for example. Adding a polyfill for it, fixes it. But then I'm seeing another error.

    When I run the script I'm seeing:

    Using targets:
    {
      "chrome": "65",
      "android": "4.4.3",
      "edge": "16",
      "firefox": "59",
      "ie": "10",
      "ios": "11",
      "safari": "11"
    }
    

    I don't want to manually add polyfills for each feature. Anyone knows if adding IE 11 to the browsers string should fix it?