diff --git a/crates/mako/src/plugins/farm_tree_shake/shake/module_concatenate/root_transformer.rs b/crates/mako/src/plugins/farm_tree_shake/shake/module_concatenate/root_transformer.rs index 7b58458a5..947a9b04f 100644 --- a/crates/mako/src/plugins/farm_tree_shake/shake/module_concatenate/root_transformer.rs +++ b/crates/mako/src/plugins/farm_tree_shake/shake/module_concatenate/root_transformer.rs @@ -141,105 +141,6 @@ impl<'a> VisitMut for RootTransformer<'a> { } else { None }; - - // let source = import_decl.src.value.to_string(); - - // if let Some(imported_module_id) = - // self.import_source_to_module_id.get(&source) - // { - // if let Some(mapped_exports) = self - // .concatenate_context - // .modules_in_scope - // .get(imported_module_id) - // { - // items = Some(vec![]); - // - // for import_specifier in &import_decl.specifiers { - // match import_specifier { - // ImportSpecifier::Named(named_specifier) => { - // // handle conflict name in top level - // - // let imported_symbol = if let Some(imported) = - // &named_specifier.imported - // && let ModuleExportName::Ident(imported_ident) = - // imported - // { - // imported_ident.sym.to_string() - // } else { - // named_specifier.local.sym.to_string() - // }; - // - // let mapped_export = - // mapped_exports.get(&imported_symbol).unwrap(); - // - // if !named_specifier - // .local - // .sym - // .to_string() - // .eq(mapped_export) - // { - // let var_decl_stmt: Stmt = - // quote_ident!(mapped_export.clone()) - // .into_var_decl( - // VarDeclKind::Var, - // named_specifier.local.clone().into(), - // ) - // .into(); - // if let Some(a) = items.as_mut() { - // a.push(var_decl_stmt.into()); - // } - // } - // } - // ImportSpecifier::Default(default_specifier) => { - // if let Some(ex) = mapped_exports.get("default") { - // let stmt: Stmt = quote_ident!(ex.clone()) - // .into_var_decl( - // VarDeclKind::Var, - // default_specifier.local.clone().into(), - // ) - // .into(); - // - // items.as_mut().unwrap().push(stmt.into()); - // } else { - // println!( - // "try get defaut from {}({}) in {}", - // source, - // imported_module_id.id, - // self.current_module_id.id - // ); - // println!("the map {:?}", mapped_exports); - // - // let stmt: Stmt = quote_expr!(DUMMY_SP, null) - // .into_var_decl( - // VarDeclKind::Var, - // default_specifier.local.clone().into(), - // ) - // .into(); - // - // items.as_mut().unwrap().push(stmt.into()); - // } - // } - // ImportSpecifier::Namespace(namespace) => { - // let mapped_namespace = mapped_exports.get("*").unwrap(); - // - // if !namespace.local.sym.to_string().eq(mapped_namespace) - // { - // let var_decl_stmt: Stmt = - // quote_ident!(mapped_namespace.clone()) - // .into_var_decl( - // VarDeclKind::Var, - // namespace.local.clone().into(), - // ) - // .into(); - // if let Some(a) = items.as_mut() { - // a.push(var_decl_stmt.into()); - // } - // } - // } - // } - // } - // } - // } } ModuleDecl::ExportDecl(_) => {} ModuleDecl::ExportNamed(export_named) => {