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

Export declaration with specifier has export specifiers identifiers tied to local declarations #2996

Closed
dsherret opened this issue Dec 9, 2021 · 3 comments
Labels

Comments

@dsherret
Copy link
Contributor

dsherret commented Dec 9, 2021

Describe the bug

An export declaration (swc: named export) with module specifier's export specifiers are getting resolved as identifier references. I have a fix incoming.

Input code

import { Ident } from "./ident";

export { Ident } from "./ident";

Output Code When Mangled

import { Ident as a } from "./ident";
export { a as Ident } from "./ident";

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false
    },
    "transform": {
      "optimizer": {
        "jsonify": {
          "minCost": 0
        }
      }
    },
    "target": "es2021",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": {
        "toplevel": false,
        "keep_classnames": false,
        "keep_fnames": false,
        "keep_private_props": false,
        "ie8": false,
        "safari10": false
      }
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true
}

Playground link

https://play.swc.rs/?version=1.2.118&code=H4sIAAAAAAAAA8vMLcgvKlGoVvBMSc0rUahVSCvKz1VQ0tPPBPGVrHm5eLmS8%2FOK83NS9XLy0zXAyjTBwqkVhLQCAG1DNttdAAAA&config=H4sIAAAAAAAAA21QS24CMQy9i9csBhYIzZZ1z1BZg4NCk9iyDWKKcvcmdGBUqas8v5%2FsPOBiE4wPEFQj7cjm4niHEXwWskmjOGzArVEBk1Ftg2KxwJq7n8Vjjt%2B%2F4YtxiWHuMMdyZHMYh1p7BvVMbQKy3bDbtsrEbLSUbrp9CU6cRclslbCcE3XJWRLdKL2lLyL5nBKaFcxkf%2FnwDycab%2BjUXpZVinR4Y8OAGrfD69y%2BfObTddmgfcrziD3UdelXjX0sRtcr1R8cWxKAXQEAAA%3D%3D

Expected behavior

Should remain as export { Ident } from "./ident";

Version

1.2.118

Additional context

No response

@dsherret dsherret added the C-bug label Dec 9, 2021
@dsherret dsherret changed the title export declaration with specifier has export specifiers identifiers tied to local declarations Export declaration with specifier has export specifiers identifiers tied to local declarations Dec 9, 2021
@kwonoj
Copy link
Member

kwonoj commented Dec 9, 2021

this repro looks same as #2924 ?

@dsherret
Copy link
Contributor Author

dsherret commented Dec 9, 2021

Yup, my search had "export declaration" and that filtered that one out.

Duplicates #2924.

@dsherret dsherret closed this as completed Dec 9, 2021
@swc-bot
Copy link
Collaborator

swc-bot commented Oct 20, 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 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants