Skip to content

Commit

Permalink
fix: issue removing exports in stripTypes mode
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Jan 11, 2024
1 parent f0de5cb commit 4a556be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/eighty-beers-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@marko/compiler": patch
"marko": patch
"@marko/translator-default": patch
---

Fix issue where additional exports were being removed when stripping typescript types.
4 changes: 3 additions & 1 deletion packages/compiler/src/babel-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ export default (api, markoOpts) => {
},
ExportNamedDeclaration: {
exit(path) {
const { node } = path;
// The babel typescript plugin will add an empty export declaration
// if there are no other imports/exports in the file.
// This is not needed for Marko file outputs since there is always
// a default export.
if (path.node.specifiers.length === 0) path.remove();
if (!(node.declaration || node.specifiers.length))
path.remove();
},
},
}
Expand Down

0 comments on commit 4a556be

Please sign in to comment.