diff --git a/src/babel/traversal/path/index.js b/src/babel/traversal/path/index.js index 23b971a900..408726f235 100644 --- a/src/babel/traversal/path/index.js +++ b/src/babel/traversal/path/index.js @@ -699,9 +699,12 @@ export default class TraversalPath { // call the function with the params (node, parent, scope, state) var replacement = fn.call(this, node, this.parent, this.scope, this.state); if (replacement) { + var previousType = this.type; this.replaceWith(replacement, true); - this.queueNode(this); - break; + if (this.type !== previousType) { + this.queueNode(this); + break; + } } if (this.shouldStop || this.removed) break;