Posts

Showing posts with the label plugins

Babel plugins run order

Babel plugins run order 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 from diving into Babel sources? I'm developing my own Babel plugin. I noticed, that when I run it, my plugin is run before other es2015 plugins. For example having code such as: const a = () => 1 and visitor such as: visitor: { ArrowFunctionExpression(path) { console.log('ArrowFunction') }, FunctionExpression(path) { console.log('Function') }, } my plugin observes ArrowFunction (and not Function). I played with the order in which the plugins are listed in Babel configuration, but that didn't change anything: plugins: ['path_to_myplugin', 'transform-es2015-arrow-functions'], plugins: ['transform-es2015-arrow-functions', 'path_to_myplugin'], OTOH, this looks like the order DOES somehow matter: https://phabricator.babelj...