[Docs] Make it clear what dependencies should be imported when using @babel/preset-env together with useBuiltIns options
Hi,
I've read the @babel/preset-env documentation several times, but I'm still not 100% sure If I get it all correctly.
To me, it seems that:
- when
@babel/preset-envis used together withuseBuiltIns: 'usage'then no additional dependencies need to be imported in our entry file. Babel will pick and import all the polyfills for us based on features used in the transpiled code (and based on an additional configuration like browserslist config ortargetconfig option). - when we use
useBuiltIns: 'entry'then we need to add the following lines to our entry file:import 'core-js/stable'; import 'regenerator-runtime/runtime'; - when we use
useBuiltIns: falsethen we have to import the entire@babel/polyfillor import individual polyfills.
Both: usage and entry options require the core-js lib to be installed.
Could you improve the docs and make it really clear? Some examples would be very helpful.
Hey @wujekbogdan! 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."
Hey @wujekbogdan! 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.
@babel/polyfill has been deprecated.
Yeah, because it was just a wrapper around core-js@2 and regenerator-runtime.
We decided to let users include these two dependencies themselves so that they can control the version (and we don't take the merit of what core-js does).