Skip to content

Regression in code generation of cached nodes #2078

@sophiebits

Description

@sophiebits

(Not sure if the issue title is actually accurate, please rename.)

Previously

var babel = require('./packages/babel');

var plugin = new babel.Transformer('test', {
  JSXElement: function (node, parent, scope, file) {
    var openName = node.openingElement.name.name;
    if (openName === 'foo' && node.children[0].type === 'Literal') {
      return node.children[0];
    }
  }
});

console.log(babel.transform('var x = <foo>bar</foo>;', {whitelist: [], plugins: [plugin]}).code);

printed

var x = "bar";

but now it prints

var x = bar;

I bisected this to f0994f1. I assume the old printing of the node is getting cached somehow. Bug or feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions