A
A
Alexander Knyazev2017-03-01 09:50:45
JavaScript
Alexander Knyazev, 2017-03-01 09:50:45

Which of the presets does Babel use when compiling code?

In my .babelrc file I have:

"presets": [
        "es2015",
        "stage-0"
    ],

How does compilation work in this case? If the first preset does not know what this code is, then the next one comes into play, or what?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2017-03-01
@bingo347

Each preset is just a set of plugins
plugins are of 2 types - syntactic and transformational
syntactic plugins work at the stage of parsing the code and are needed to build an ast tree
transformation plugins work with a ready ast tree and change it
all plugins of the same type work essentially together

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question