Babel adding unnecessary core-js polyfills for IE11

442 Views Asked by At

In my app, I have configured Babel to add Core-JS polyfills, but it seems to be adding unnecessary polyfills.

Im using browserlist > 1% and it's including require("core-js/modules/es.array.concat"); among other Core-JS imports that don't seem necessary. I checked and it's because of IE11, but IE11 does support string concatenation with +, so this import doesn't seem necessary.

Is there a way to not allow adding these polyfills while still supporting at least IE11?

1

There are 1 best solutions below

0
On

Assuming you are using preset-env you can exclude them directly with an array of excluded modules.

    ...

    "targets" : "browserlist > 1%",
    "exclude": [
        "es.array.concat",
    ],

    ...