Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mangle] exporting from along with importing the same variable name doesn't work #2924

Closed
neuronetio opened this issue Dec 1, 2021 · 2 comments · Fixed by #3139
Closed
Assignees
Labels
Milestone

Comments

@neuronetio
Copy link

neuronetio commented Dec 1, 2021

Describe the bug

just run the code

Input code

import { y } from 'z';
export { y } from 'z';

Output

import { y as a } from 'z';
export { a as y } from 'z'; // <- a is not defined in z

Playground link

Playground

Expected behavior

exported value should keep proper name

Version

1.2.114

Additional context

No response

@neuronetio neuronetio changed the title exporting from along with importing the same variable name doesn't work [mangle] exporting from along with importing the same variable name doesn't work Dec 1, 2021
@kdy1 kdy1 modified the milestones: v1.2.115, v1.2.116, v1.2.117, v1.2.118, v1.2.119 Dec 1, 2021
@dsherret
Copy link
Contributor

dsherret commented Dec 9, 2021

This also sometimes occurs when transforming and not mangling. It's a problem in the resolver code.

@kdy1 kdy1 modified the milestones: v1.2.119, v1.2.120, v1.2.121 Dec 10, 2021
@kdy1 kdy1 modified the milestones: v1.2.121, v1.2.122, v1.2.123, v1.2.124 Dec 19, 2021
@kdy1 kdy1 self-assigned this Dec 29, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Dec 29, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Dec 29, 2021
kdy1 added a commit that referenced this issue Dec 29, 2021
swc_ecma_transforms_base:
 - `resolver`: Ignore named export with source.
 - `hygiene`: Ignore named export with source. (Closes #2924, Closes #3114)

swc_ecma_minifier:
 - Handle `export default` declarations as declaration instead of expressions. (Closes #2717)
 - Don't override already-processed identifiers. (Closes #2988)

swc_bundler:
 - Adjust the syntax context for named re-exports.
@swc-bot
Copy link
Collaborator

swc-bot commented Oct 19, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

4 participants