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?).

Avery
  • 2,270
  • 4
  • 33
  • 35
tomhughes
  • 4,597
  • 2
  • 24
  • 33
  • 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://stackoverflow.com/a/48747912/4061006 – Jayavel Feb 27 '18 at 10:23

0 Answers0