简体   繁体   中英

Babel adding unnecessary core-js polyfills for IE11

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?

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

    ...

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

    ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM