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

eval() + export default named function changes exported function name #9129

Closed
JSerFeng opened this issue Jul 3, 2024 · 1 comment · Fixed by #9135
Closed

eval() + export default named function changes exported function name #9129

JSerFeng opened this issue Jul 3, 2024 · 1 comment · Fixed by #9135
Assignees
Labels
Milestone

Comments

@JSerFeng
Copy link
Contributor

JSerFeng commented Jul 3, 2024

Describe the bug

swc changes symbol Foo to Foo1

but references still use original symbol Foo

Input code

eval('')
export default function Foo() {
}

Foo()

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": true,
      "decorators": true
    },

    "target": "es2022",
    "transform": {
      "decoratorMetadata": true,
      "react": {
        "refresh": true,
        "development": true
      }
    },
    "externalHelpers": true,
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": "unknown"
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.6.6&code=H4sIAAAAAAAAA0stS8zRUFfX5EqtKMgvKlFISU1LLM0pUUgrzUsuyczPU3DLz9fQVKjmquXiAjMB8lv%2BRDEAAAA%3D&config=H4sIAAAAAAAAA1WQMQ6DMAxFd06BPDNUDB16gi4cwgKDaEMS2UYtQty9AUIKW%2Fz%2F93%2BK5yzP4SU1PPI5PMPgkYU4zUGRySp%2BgwI6eZKae69QHK7KaimPlKSGaseojiU6m7EU2U5Q5I507SMpb2UZu0AZrbSOhzM8dVWk2KDiBbbEVfoqsUXzJOMpYaNpnBMKUotGDm3obd9OZ1DtBs8kcg2uUbSdSfs7NotoGFwzbma83nqh%2FWd3%2BIcOWCqGXqpjE0b7tu5jIVt%2BiIOM6I4BAAA%3D

SWC Info output

No response

Expected behavior

Should not change the exported original name

Actual behavior

No response

Version

1.6.6

Additional context

No response

@JSerFeng JSerFeng added the C-bug label Jul 3, 2024
@JSerFeng JSerFeng changed the title react refresh use wrong symbol eval() + export default named function changes exported function name Jul 3, 2024
@kdy1 kdy1 self-assigned this Jul 3, 2024
@kdy1 kdy1 added this to the Planned milestone Jul 3, 2024
@kdy1 kdy1 closed this as completed in #9135 Jul 4, 2024
@kdy1 kdy1 closed this as completed in 45f671d Jul 4, 2024
@kdy1 kdy1 modified the milestones: Planned, v1.6.10 Jul 6, 2024
@swc-bot
Copy link
Collaborator

swc-bot commented Aug 5, 2024

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 Aug 5, 2024
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.

3 participants