A little backstory here: when babel first came out, you used it by installing "presets" that supported a very specific set of next-gen language features. For instance, babel-preset-es2015 would add, you guessed it, all language features added in ES2015.
This worked out fine for awhile, but pretty soon it became clear that not only were there going to be new language features added every year, but there would be new language features added constantly. Having to install a new preset every time new language features became available would mean having to add babel-preset-es2016 and babel-preset-es2017 in addition to babel-preset-es2015 and maybe even having to add something ridiculous like babel-preset-es-mid-march-2018 (mostly just kidding on that last one but barely).
So babel switched over to recommending something call babel-preset-env. This preset is like the one preset to rule them all: it always contains the latest language features that aren't super-duper bleeding edge, and you can easily configure it to only include polyfills for a specific range of browsers you want to support.
Here, I've configured babel-preset-env to include enough polyfills to support all browsers with global usage greater than 1%, and the past 2 versions of all browsers. This results in a pretty broad compatibility list.
A little backstory here: when babel first came out, you used it by installing "presets" that supported a very specific set of next-gen language features. For instance,
babel-preset-es2015
would add, you guessed it, all language features added in ES2015.This worked out fine for awhile, but pretty soon it became clear that not only were there going to be new language features added every year, but there would be new language features added constantly. Having to install a new preset every time new language features became available would mean having to add
babel-preset-es2016
andbabel-preset-es2017
in addition tobabel-preset-es2015
and maybe even having to add something ridiculous likebabel-preset-es-mid-march-2018
(mostly just kidding on that last one but barely).So babel switched over to recommending something call
babel-preset-env
. This preset is like the one preset to rule them all: it always contains the latest language features that aren't super-duper bleeding edge, and you can easily configure it to only include polyfills for a specific range of browsers you want to support.Here, I've configured
babel-preset-env
to include enough polyfills to support all browsers with global usage greater than 1%, and the past 2 versions of all browsers. This results in a pretty broad compatibility list.Here's a nice visualization of all browsers that will be be covered by these rules