Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue removing exports in stripTypes mode #2079

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading