New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Way to exclude some polyfills completely. #11425
Comments
Hey @pacifier007! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
Doesn't Also, those polyfills you have in your output are not related to import "core-js/modules/es.string.includes";
array.includes('string'); This is what I get when targeting an older browser (ie 7): import "core-js/modules/es.array.includes";
import "core-js/modules/es.string.includes";
array.includes('string'); |
Whoops. Sorry about that. My example wasn't correct as I had a lot of ES5 code in there too - that I didn't think would trigger any polyfills at all. I can confirm That brings me to a similar query. Is there any way to ignore a whole chunk of ES5 code (or any code), to not be polyfilled. I couldn't find any. Something like autoprefixer or eslint |
Related: #9170 , zloirock/core-js#518. About the suggestion to have an option to disable polyfilling a block of code: Suppose you have two browsers as your targets and you disable polyfilling for a block of code that needs polyfills on the first browser, but doesn't on the second. This will leave you with a bundle that will run on the browser that supports the features natively, failing in the other browser, because you disabled polyfilling in your code. This is why |
I'm closing this issue as partially answered, and partially moved to babel/babel-polyfills#11 (which is the repo where we'll implement polyfills innovations) |
Feature Request
When using
useBuiltIns: "usage"
, a lot of polyfills added may not be needed at all for my target browsers (ES7, I tried with Edge > 16). For example, when I usearray.includes('string')
, the following get added:This adds in a lot of code that's unnecessary for my usage.
In babel/env options, I can add these all to the
exclude
but these may be relevant to another polyfill.Suggestion
Please add a way to exclude specific methods or features. For instance, it would be quite useful to be able to exclude
array.includes, string.includes
or even all.includes()
entirely.The text was updated successfully, but these errors were encountered: