-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
@babel/preset-env not explicit about the need for Polyfills #2496
Comments
Hey @thernstig! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
Obvious answer to this question probably, but being explicit here: NOT having polyfills (via e.g. That is why I feel this is so important so users understand that option is important. |
Reading https://babeljs.io/docs/en/babel-preset-env
For example https://babeljs.io/docs/en/babel-preset-env#browserslist-integration has an example where
"useBuiltIns": "entry"
is used. This will however only work if a user has added polyfills already. For many (most) new projects I would suspect users to not have manually added polyfills. Would theuseBuiltIns: "usage"'
(https://babeljs.io/docs/en/babel-preset-env#usebuiltins) then be more natural for users to use? Because the text says this, it is not entirely true this will work for many projects:What I am missing early in the documentation is the fact that
useBuiltIns
is most often very important. Would it not make sense to have a paragraph about that "To handle polyfills you have two options. 1) You have not added them manually in the codebase, then take a look at useBuiltIns: 'usage'. 2) You already have polyfills manually added, then take a look atuseBuiltIns: "entry"
.In essence I feel the text is quite clear on that it does transforms early on, but for newcomers it is not clear that polyfills are needed. So in most new projects where you would want
@babel/preset-env
to automatically inject polyfills, that is not clear. And it is very important, otherwise your app will not work on the targets you specified in your browserslist config.The text was updated successfully, but these errors were encountered: