Skip to content

Commit ece8f3e

Browse files
committed
fix(es/cjs): reassign exports for the functions
Signed-off-by: OJ Kwon <kwon.ohjoong@gmail.com>
1 parent 0ac7743 commit ece8f3e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ecmascript/transforms/module/src/common_js.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,19 @@ where
184184
_ => unreachable!(),
185185
};
186186

187-
//
188187
extra_stmts.push(ModuleItem::Stmt(Stmt::Decl(decl.fold_with(self))));
189188

189+
if !is_class {
190+
let mut scope = self.scope.borrow_mut();
191+
scope
192+
.exported_vars
193+
.entry((ident.sym.clone(), ident.span.ctxt()))
194+
.or_default()
195+
.push((ident.sym.clone(), ident.span.ctxt()));
196+
197+
drop(scope);
198+
}
199+
190200
let append_to: &mut Vec<_> = if is_class {
191201
&mut extra_stmts
192202
} else {

0 commit comments

Comments
 (0)