zloirock / core-js

Standard Library
MIT License
23.99k stars 1.62k forks source link

How do I set my babelrc to let it not polyfill array.push because I am satisfied with browsers' implementation for array.push #1311

Closed qiulang closed 6 months ago

qiulang commented 6 months ago

Hi, this is a question I don't know whether I should raise to corejs or babeljs. I don't want babel to polyfill array.push. But how ?

I have the following .babelrc but I still see array.push is injected.

                    "useBuiltIns": "usage",
                    "shippedProposals": true,
                    "corejs": {
                        "version": 3.33
                        "proposals": false
                    }

After all, this is a very basic array function I am happy with browsers' (chromium browsers) implementation.

I read the array.push but it is not clear to me how you implement push function.

zloirock commented 6 months ago

Array#push is polyfilled in modern V8 -> Chrome because of a bug in some specific cases, the info you could find in the files that you mentioned.

You could use exclude preset-env option to exclude this polyfill.

It's not the correct place for questions about .babelrc, it's better to ask Babel team about it.

zloirock commented 6 months ago

An example of usage exclude option.