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

Unknown minify bug, causes infinite run #6729

Closed
JSerFeng opened this issue Dec 29, 2022 · 2 comments · Fixed by #6744
Closed

Unknown minify bug, causes infinite run #6729

JSerFeng opened this issue Dec 29, 2022 · 2 comments · Fixed by #6744
Assignees
Labels
Milestone

Comments

@JSerFeng
Copy link
Contributor

Describe the bug

Simple code that makes SWC hang for ever.

How to reprod ?

Go to the playground link below, then enable compress, you will find browser blocks

Input code

export async function foo() {
  if (undefined_var_1) {
    let replace;
  
    if (undefined_var_2) {
      replace = 1;
    } else {
      replace = 2;
    }
  
    await a({ replace })
  }
}

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "decorators": true,
      "tsx": false
    },
    "target": "es2020",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": true,
  "isModule": true
}

Playground link

https://play.swc.rs/?version=1.3.24&code=H4sIAAAAAAAAA22OSwqEMBAF9znFW8albsWzSBM7EAgdiXFUJHf3m9nMbKuKx%2BN1DDGBpk0M7CwmuSCwIegKuwKchZ5lYOuEh%2F5Dsa8fAXhOiDx6Mtye4Ga%2FeVNylBgd6vZGGewn%2FuOb15dZWsidJ%2FX%2BbXKlLp%2FVATGG0ebBAAAA&config=H4sIAAAAAAAAA0WOPQ7DIAxG7%2BKZIcrQgTv0EBZxIioCyHakIsTdC0mqbP5537MrfMSBrZCRhXhUUqLiFyxoySSOfVYwsJBLjJpYwCofZEClQysGodYb5I20h0jmaZ56IKQkdAMGdh%2F9WobepT0ziTwrjFv4k6279rQcY1DPD07nC9rjuM57ed%2Fc6NsPsPYZ%2F8kAAAA%3D

Expected behavior

Normally get result.

Actual behavior

SWC running without error and don't stop.

Version

1.3.24

Additional context

No response

@JSerFeng JSerFeng added the C-bug label Dec 29, 2022
@kdy1 kdy1 added this to the Planned milestone Dec 30, 2022
@kdy1 kdy1 self-assigned this Dec 30, 2022
@JSerFeng
Copy link
Contributor Author

I might have found reason, Enable unused and reduce_vars both will reproduce the problem

@swc-bot
Copy link
Collaborator

swc-bot commented Feb 4, 2023

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 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 participants