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

Exporting a variable called goto with env targets enabled results in it being renamed to _goto #8539

Closed
louy opened this issue Jan 22, 2024 · 1 comment · Fixed by #8543
Closed
Assignees
Labels
Milestone

Comments

@louy
Copy link

louy commented Jan 22, 2024

Describe the bug

This is an unexpected behaviour (for me at least) and I can't find any documentation about it.

Exporting a var called goto breaks with "env" set to chrome >= 12 (very old version, I know), but works fine when it isn't

I think there are other modern queries for browserslist that cause this but I can't find the one causing it to break in my config yet

Input code

export const goto = () => {
    return null
}

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": false
    },
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true,
  "env": {
    "targets": "chrome >= 12"
  }
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.3.100&code=H4sIAAAAAAAAA0utKMgvKlFIzs8rLlFIzy%2FJV7BV0NBUsLVTqOZSAIKi1JLSojyFvNKcHK5aADno1WEtAAAA&config=H4sIAAAAAAAAA1WOSw7CMAxE9z1F5DUL2LBAghtwiCi4JVV%2BslNEVfXuJGlT2p09M36eqRECelZwE1Ma0xIkMdK2J4VHF%2BU3KYDKSlakQ4RTdXvOVisNY5HmxQHjPWN1Vs1qp9txz1beBkLmYzBHpesMHsnNSgfrX0Mx185xDFj68RX%2BofpsA4PmZ72MNCwaus8OJKnDmNuAepO3KB53cTkXaDP%2FAKOSXIktAQAA

SWC Info output

No response

Expected behavior

No renames in the export, or a rename when importing, or an error being thrown

Actual behavior

Exported variable gets renamed, but when importing it it doesn't

Version

1.3.100

Additional context

No response

@louy louy added the C-bug label Jan 22, 2024
@kdy1 kdy1 added this to the Planned milestone Jan 23, 2024
@kdy1 kdy1 self-assigned this Jan 23, 2024
kdy1 added a commit that referenced this issue Jan 23, 2024
@kdy1 kdy1 modified the milestones: Planned, v1.3.106 Jan 24, 2024
@swc-bot
Copy link
Collaborator

swc-bot commented Feb 23, 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 Feb 23, 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