Repository: swc-project/swc (rust)

Issue:
path.alias are not replaced from export *
### Describe the bug

`paths` of `export *`  are not replaced.
```tsx
export * from '@/a.js';
```


### Input code

```typescript
// will not replace the alias
export * from '@/a.js';

// replaced
import '@/a.js'
export {} from '@/a.js';
```


### Config

```json
{
  "jsc": {
    "baseUrl": "./",
    "paths": {
      "@/*": [
        "./src/*"
      ]
    },
    "parser": {
      "syntax": "ecmascript",
      "jsx": false
    },
    "target": "es5",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true
}
```


### Playground link

https://play.swc.rs/?version=1.3.7&code=H4sIAAAAAAAAA8vMLcgvKlFQd9BP1MsqVuflSq0AC1TXKqQV5efCJazhMlpoEgAogjIzQgAAAA%3D%3D&config=H4sIAAAAAAAAA0WMsQ7CMAxE%2F8UjqugEQyd%2BgJEJMZjgllRJE9muRFXl33FQUbfTvXe3wigOuhWeKHTjAB0cW2ggo76l9pf2AN3dSmFn8VEqYyGuUJZJ8WMbchHFsc9q21Gs6jEImazIA2lV5GQspCS00Qain3y%2F1CeXYmYS2RFOQ%2FibxY5ies21WEGXTL%2FDM5T9Y9t5uW6i8kzlC5VpMQHgAAAA

### Expected behavior

replace the alias
```ts
export * from '@/a.js';
```
=>
```ts
export * from './src/a.js'
```

### Actual behavior

paths are not replaced.
```ts
export * from '@/a.js';
```
=>
```ts
export * from './src/a.js'
```

### Version

1.3.8

### Additional context

_No response_

Pull request description:
fix(es/module): Resolve `path.alias` for export all
<!-- Note: CI script will automatically rebase your PR so please do not rebase unless required -->

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->

**Description:**

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

**BREAKING CHANGE:**

<!--
If this PR introduces a breaking change, it must contain a notice for it to be included in the CHANGELOG. Add description or remove entirely if not breaking.

You may need to update `MIGRATION.md` for the breaking changes.
-->

**Related issue (if exists):**
- fix #6159 

Patch:
diff --git a/crates/swc_ecma_transforms_module/src/rewriter.rs b/crates/swc_ecma_transforms_module/src/rewriter.rs
index 0149f9d13b..631e3c2ad6 100644
--- a/crates/swc_ecma_transforms_module/src/rewriter.rs
+++ b/crates/swc_ecma_transforms_module/src/rewriter.rs
@@ -69,4 +69,17 @@ where
             src.value = new;
         }
     }
+
+    fn visit_mut_export_all(&mut self, n: &mut ExportAll) {
+        let mut src = &mut n.src;
+
+        let new = self
+            .resolver
+            .resolve_import(&self.base, &src.value)
+            .with_context(|| format!("failed to resolve import `{}`", src.value))
+            .unwrap();
+
+        src.raw = None;
+        src.value = new;
+    }
 }


Test patch:
diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/index.ts b/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/index.ts
new file mode 100644
index 0000000000..95fb7eaefe
--- /dev/null
+++ b/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/index.ts
@@ -0,0 +1,3 @@
+import "@/a.js";
+export {} from "@/a.js";
+export * from "@/a.js";
diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/paths.json
new file mode 100644
index 0000000000..0550ae4201
--- /dev/null
+++ b/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/paths.json
@@ -0,0 +1,5 @@
+{
+    "@/*": [
+        "./src/*"
+    ]
+}
\ No newline at end of file
diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-6159/output/index.ts b/crates/swc_ecma_transforms_module/tests/paths/issue-6159/output/index.ts
new file mode 100644
index 0000000000..e8309b1a02
--- /dev/null
+++ b/crates/swc_ecma_transforms_module/tests/paths/issue-6159/output/index.ts
@@ -0,0 +1,3 @@
+import "./src/a.js";
+export { } from "./src/a.js";
+export * from "./src/a.js";