fix exported classes with static class properties - fixes #2868
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
export class MyClass {
|
||||
static property = value;
|
||||
}
|
||||
|
||||
export default class MyClass2 {
|
||||
static property = value;
|
||||
}
|
||||
12
packages/babel-plugin-transform-class-properties/test/fixtures/general/static-export/expected.js
vendored
Normal file
12
packages/babel-plugin-transform-class-properties/test/fixtures/general/static-export/expected.js
vendored
Normal 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;
|
||||
Reference in New Issue
Block a user