My question is : What\'s the difference between babel-preset-stage-0
,babel-preset-stage-1
,babel-preset-stage-2
and babel-preset-
This is the best starting point to understand. What are babel presets
An excerpt from the link:
Stage 0 - Strawman: just an idea, possible Babel plugin.
Stage 1 - Proposal: this is worth working on.
Stage 2 - Draft: initial spec.
Stage 3 - Candidate: complete spec and initial browser implementations.
Stage 4 - Finished: will be added to the next yearly release
Overall Picture:
preset
in babel's terms. And each preset contains plugins from various levels of risk.preset-0
It means it has plugins for features which are very experimental and hence at high risk of making it out to final spec. Its like an idea that came to a developer that Javascript should have a particular feature, and he did some work to get it to TC-39 proposal process. preset-1
It contains the plugins for the feature ideas accepted by the TC-39, and they find it worth working on.preset-2
Plugins for features where an initial draft is ready for the feature.
And it goes on..So it could happen that a feature in Stage 0 reached Stage 2 in some time and end up being in next release of Javascript some more time later.
Hence with each version of these Babel Presets, you could find different set of plugins in it. It could also happen that a feature in stage 0 went through some changes and it made breaking changes into how it functions. And it reached, lets say stage-2 with a totally different API. So developers have to make sure that when they are updating these plugins they make necessary changes to their code.