@babel/preset-env: Clarify `useBuiltIns` usage and purpose
This PR clarifies what useBuiltIns is for, and how to use it, better (IMO 🙂).
Specifically, I really struggled using this option in one of my projects. It took me a long time to understand:
- That this option only told Babel how to import polyfills, and that it didn't come with them
- Specifically, that you had to
npm installthem yourself
- Specifically, that you had to
-
core-jsandregenerator/regenerator-runtimewere exactly the two polyfills it supported- The old documentation focuses on
core-js, and brushes overregenerator
- The old documentation focuses on
-
regenerator-runtime/runtimewas installed via theregeneratornpm package- Just took me a while to figure which exact package to install (
regenerator-runtime? Justregenerator?)
- Just took me a while to figure which exact package to install (
Feedback welcome 😃
Deploy preview for babel failed.
Built with commit 6f82595890be62a7fc6748d0b27a02a1cd5f2cd4
https://app.netlify.com/sites/babel/deploys/5e6c15e822b418000b7f7649
Could we also add a note that it is incompatible with transform-runtime? (ref: https://github.com/babel/babel/issues/10271)
Could we also add a note that it is incompatible with
transform-runtime? (ref: babel/babel#10271)
@nicolo-ribaudo But if preset-env and transform-runtime don't work together, won't people lose the benefit of sharing the runtime/helper code across the entire project? Not sure people are going to like that.
Sorry, I meant with transform-runtime's core-js option
Could we also add a note that it is incompatible with
transform-runtime? (ref: babel/babel#10271)
Do you have wording in mind on this? Might be easier than me trying to come up with something and having it be inaccurate 😅