Do I still need to use babel-preset-env and Babel plugins if I am using babel-polyfill?
Asked Answered
K

0

6

My understanding is that the Babel Polyfill emulates a full ES6 environment, whereas babel-preset-env compiles ES6 (and beyond) to ES5 automatically based on the environments (browsers) you need to support.

I have a few questions regarding this:

  • Are both of these designed to be used alongside each other, or in place of each other?

  • If they are designed to be an alternative to each other, is there a reason to choose one over the other? Is one more performant?

  • When using either of these tools, is there still a need to use additional Babel plugins, or will one of these include every plugin I would need to write modern JavaScript that conforms to the spec (stage 4 proposals only, I imagine plugins are needed for stage 3 and below?).

Korrie answered 2/2, 2018 at 16:8 Comment(1)
With my understanding preset env supports only es6 completed features. Apart from that If you need to use other es6 less stable proposals ,you should install babel-stage-3, babel-polyfill more read comments at https://mcmap.net/q/1719990/-add-dynamic-html-attributes-to-child-component-from-parent-component-react-jsDorton

© 2022 - 2024 — McMap. All rights reserved.