Only attempt to rename export declarations, not expressions - fixes T7215

This commit is contained in:
Logan Smyth
2016-03-16 23:26:52 -07:00
parent 374b5d273a
commit 078f6c0ed3
4 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
export default (onClick) => ({
onClick: function(){
onClick(text);
},
});

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (_onClick) {
return {
onClick: function onClick() {
_onClick(text);
}
};
};

View File

@@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"plugins": ["external-helpers"]
}

View File

@@ -105,7 +105,7 @@ export default class Renamer {
let { binding, oldName, newName } = this;
let { scope, path } = binding;
let parentDeclar = path.find((path) => path.isDeclaration() || path.isFunctionExpression());
let parentDeclar = path.find((path) => path.isDeclaration());
if (parentDeclar) {
this.maybeConvertFromExportDeclaration(parentDeclar);
}