Skip to content

Commit fa82205

Browse files
committed
updating lib
1 parent 3c69871 commit fa82205

File tree

1 file changed

+7
-5
lines changed
  • codepress-swc-plugin/src

1 file changed

+7
-5
lines changed

codepress-swc-plugin/src/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4001,9 +4001,6 @@ impl VisitMut for RefreshProviderWrapper {
40014001
Expr::Ident(ident) => {
40024002
found_default_export = true;
40034003

4004-
// Clone the ident to preserve its SyntaxContext for the wrapper
4005-
let original_ident = ident.clone();
4006-
40074004
// Create: const __CP_OriginalApp = App;
40084005
let original_decl = ModuleItem::Stmt(Stmt::Decl(Decl::Var(Box::new(VarDecl {
40094006
span: DUMMY_SP,
@@ -4024,8 +4021,13 @@ impl VisitMut for RefreshProviderWrapper {
40244021
}))));
40254022
new_items.push(original_decl);
40264023

4027-
// Create wrapper export (pass original_ident to preserve SyntaxContext)
4028-
let wrapper = Self::create_wrapper_default_export(span, Some(original_ident));
4024+
// Create wrapper export.
4025+
// IMPORTANT: Do NOT pass the original ident here because the original
4026+
// `function App` declaration still exists in the module. Passing the
4027+
// original ident would create a duplicate binding. The __CP_stamp
4028+
// reference to the original App is still valid since the original
4029+
// function declaration remains.
4030+
let wrapper = Self::create_wrapper_default_export(span, None);
40294031
new_items.push(wrapper);
40304032
}
40314033

0 commit comments

Comments
 (0)