Skip to content

Commit

Permalink
fix: export default specifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinbao1001 committed Dec 5, 2024
1 parent 12adc52 commit 05f3267
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions crates/mako/src/plugins/imports_checker/collect_exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ impl<'a> Visit for CollectExports<'a> {
let source = all.src.value.to_string();
self.exports_star_sources.push(source);
}
// export {a, b} || export {default as c} from 'd'
// export {a, b} || export {default as c} from 'd' || export a from 'b'
ModuleDecl::ExportNamed(named) => {
named.specifiers.iter().for_each(|specifier| {
match &specifier {
named
.specifiers
.iter()
.for_each(|specifier| match &specifier {
ExportSpecifier::Named(named) => {
if let Some(ModuleExportName::Ident(ident)) = &named.exported {
self.specifiers.remove(&ident.sym.to_string());
Expand All @@ -55,11 +57,10 @@ impl<'a> Visit for CollectExports<'a> {
self.specifiers.remove(&ident.sym.to_string());
}
}
_ => {
//@todo what is ExportDefaultSpecifier?
ExportSpecifier::Default(default) => {
self.specifiers.remove(&default.exported.sym.to_string());
}
}
})
})
}
_ => {}
}
Expand Down

0 comments on commit 05f3267

Please sign in to comment.