fix exported classes with static class properties - fixes #2868

This commit is contained in:
Sebastian McKenzie 2015-11-10 15:56:22 -08:00
parent 29f756fd6f
commit 54c13eef5c
24 changed files with 24 additions and 2 deletions

View File

@ -134,6 +134,10 @@ export default function ({ types: t }) {
nodes.push(t.expressionStatement(ref));
}
if (path.isClassDeclaration() && path.parentPath.isExportDeclaration()) {
path = path.parentPath;
}
path.insertAfter(nodes);
}
}

View File

@ -0,0 +1,7 @@
export class MyClass {
static property = value;
}
export default class MyClass2 {
static property = value;
}

View File

@ -0,0 +1,12 @@
export var MyClass = function MyClass() {
babelHelpers.classCallCheck(this, MyClass);
};
MyClass.property = value;
var MyClass2 = function MyClass2() {
babelHelpers.classCallCheck(this, MyClass2);
};
export default MyClass2;
MyClass2.property = value;

View File

@ -1,4 +1,3 @@
{
"presets": ["es2015", "react"],
"plugins": ["transform-class-properties", "external-helpers-2"]
}

View File

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