Skip to content

Commit 1a74e31

Browse files
remove "empty" export declarations
1 parent f7fb6bf commit 1a74e31

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/directive-functions-plugin/src/compilers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ function codeFrameError(
561561
}
562562

563563
const safeRemoveExports = (ast: babel.types.File) => {
564-
ast.program.body = ast.program.body.map((node) => {
564+
ast.program.body = ast.program.body.flatMap((node) => {
565565
if (
566566
babel.types.isExportNamedDeclaration(node) ||
567567
babel.types.isExportDefaultDeclaration(node)
@@ -581,6 +581,9 @@ const safeRemoveExports = (ast: babel.types.File) => {
581581
}
582582
}
583583
return node.declaration
584+
} else if (node.declaration === null) {
585+
// remove e.g. `export { RouteComponent as component }`
586+
return []
584587
}
585588
}
586589
return node

0 commit comments

Comments
 (0)