Skip to content

Commit 8d40958

Browse files
author
Zvonimir Sabljic
committed
Fix so that we can process cases 'export default class Class {...}' and 'export class Class {...}' correctly
1 parent 0035996 commit 8d40958

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/utils/code.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ function processAst(ast, cb) {
260260
return cb(prop.key.name, null, 'exportObj');
261261
}
262262
});
263+
} else if (declaration.type === 'ClassDeclaration') {
264+
return cb(declaration.id ? declaration.id.name : declaration.name, null, 'exportFnDef');
263265
}
264266
} else if (path.isExportNamedDeclaration()) {
265267
if (path.node.declaration) {
@@ -269,6 +271,8 @@ function processAst(ast, cb) {
269271
path.node.declaration.declarations.forEach(declaration => {
270272
return cb(declaration.id.name, null, 'exportFn');
271273
});
274+
} else if (path.node.declaration.type === 'ClassDeclaration') {
275+
return cb(path.node.declaration.id.name, null, 'exportFnDef');
272276
}
273277
} else if (path.node.specifiers.length > 0) {
274278
path.node.specifiers.forEach(spec => {

0 commit comments

Comments
 (0)