Skip to content

Commit

Permalink
fix: reexport star from local named export (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
underfin authored Nov 16, 2023
1 parent cbd779d commit 77c77ec
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/rolldown/src/bundler/visitors/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl<'a> Scanner<'a> {
});
} else {
decl.specifiers.iter().for_each(|spec| {
self.add_local_export(spec.local.name(), self.get_root_binding(spec.local.name()));
self.add_local_export(spec.exported.name(), self.get_root_binding(spec.local.name()));
});
if let Some(decl) = decl.declaration.as_ref() {
match decl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var init_b = __esm({
function Fn() {}
var commonjs_default,v,l,c,Class;
var commonjs_ns = {
get C() { return Class },
get Class() { return Class },
get Fn() { return Fn },
get abc() { return abc },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ function Fn() {}
class Class {}
export { Class, Fn, abc, b_ns as b, c, entry_default as default, l, v };
export { Class as C, Class, Fn, abc, b_ns as b, c, entry_default as default, l, v };
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
source: crates/rolldown/tests/common/case.rs
expression: content
input_file: crates/rolldown/tests/fixtures/reexport_star_from_named_export
---
# Assets

## main.mjs

```js
// foo.js
const value = 1;
// main.js
export { value as foo };
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const value = 1;

export { value as foo };
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './foo'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit 77c77ec

Please sign in to comment.