diff --git a/.changeset/eighty-beers-speak.md b/.changeset/eighty-beers-speak.md new file mode 100644 index 0000000000..f3d5ee8e5c --- /dev/null +++ b/.changeset/eighty-beers-speak.md @@ -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. diff --git a/packages/compiler/src/babel-plugin/index.js b/packages/compiler/src/babel-plugin/index.js index fee7e5da35..b422f8be36 100644 --- a/packages/compiler/src/babel-plugin/index.js +++ b/packages/compiler/src/babel-plugin/index.js @@ -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(); }, }, }