Babel plugins run order

前端 未结 2 2115
广开言路
广开言路 2021-02-07 08:45

TL;DR: Is there a way how to specify the order in which the Babel plugins are supposed to be run? How does Babel determine this order? Is there any spec how this works apart fro

2条回答
  •  無奈伤痛
    2021-02-07 09:11

    The order of plugins is based on the order of things in your .babelrc with plugins running before presets, and each group running later plugins/presets before earlier ones.

    The key thing though is that the ordering is per AST Node. Each plugin does not do a full traversal, Babel does a single traversal running all plugins in parallel, with each node processed one at a time running each handler for each plugin.

提交回复
热议问题