0

I have a custom babel plugin. In case a project includes multiple plugins (and possibly loaders from vue/angular), this means if, for example, two transforms both visit the "Program" node, the transforms will run in the first to last plugin order (babel docs).

But this does not often really happen. If my plugin relies on the presence of, for example, class component, but another plugin enters visitor first transforming the class to a function, my custom plugin visitot is then useless (skiped).

Is it possible to make sure my custom plugin is the first to enter before anything else transforms the code like another babel plugin/preset, vue/angular loaders etc.?

David Zaba
  • 67
  • 1
  • 9
  • I am not sure but it may be the case when angula/vue are not babel plugins and they do their own build processing even before babel starts to do its own not sure about you build process – Xesenix Jun 13 '20 at 09:49
  • Plugins visit an ast node in the first-to-last order (babel docs). Loaders/rules are applied to the code in the last-to-first order (webpack docs). My custom babel plugin is in the first place inside the babel.config.js file. Is it possible, either on the level of webpack or elsewhere, to set up the process in such a way that babel.config.js definitions run before the loaders/rules defined inside the webpack file? – David Zaba Jun 20 '20 at 06:05

0 Answers0