Skip to content

swc minify bug #10178

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

Closed
littleprincewdk opened this issue Mar 11, 2025 · 1 comment · Fixed by #10184
Closed

swc minify bug #10178

littleprincewdk opened this issue Mar 11, 2025 · 1 comment · Fixed by #10184
Assignees
Labels
Milestone

Comments

@littleprincewdk
Copy link

Describe the bug

swc does not recognize the change in the array in some situation.

Input code

var c = 'push'; // maybe any word

for (var a = 1, b = []; a < 5; a++) {
  b[c]({});
}

b[0][d] = 1;
b[e][f] = b[1][g];

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": true
    },
    "target": "es5",
    "loose": false,
    "minify": {
      "compress": {
        
      },
      "mangle": false
    },
    "externalHelpers": false
  },
  "module": {
    "type": "es6"
  },
  "minify": true,
  "isModule": true
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.11.8&code=H4sIAAAAAAAAAxWLsQqDQBAF%2B%2F2K16koqEWqjV%2BybHF7p6ZJDCcaRPz3rNUwMLOHjIgBxXdbXwWjbfEOh40InwO%2FJSeiackod%2B%2BCd30Dc4iy6xMPR11XOAkwiVqeV8V0EZl0Kknvg11GlekWk15lVv4D3BuDjHcAAAA%3D&config=H4sIAAAAAAAAA1WPPQ7DMAiF957CYu7aDj1Blx4CuaRy5D8BkRJFuXsdx0nTDT7e48F8MQZ6sfAwcylLk5GF%2BOgLkSkqjoUA2YBi2WWF6z7tZR0pD1TJsg1AkT%2Bk1SS3pgafklBhHXqhxoKLrpvOeTaFzCRyYsa0YjlyA8aPP5b9ZdOoxBH9k3wmlpOmKiCk91Ct7WWdMm2X3uEn2u9aX6vEyWs31neXL%2B8BHY89AQAA

SWC Info output

No response

Expected behavior

terser is ok:

Image

Actual behavior

swc does not recognize the change in the array:

Image

Version

1.11.8

Additional context

No response

@swc-bot
Copy link
Collaborator

swc-bot commented Apr 11, 2025

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 Apr 11, 2025
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