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

refactor(es/minifier): Pre-calculate reassigned #7832

Merged
merged 1 commit into from
Aug 24, 2023
Merged

Conversation

Austaras
Copy link
Member

Description:

BREAKING CHANGE:

Related issue (if exists):

@Austaras
Copy link
Member Author

Austaras commented Aug 18, 2023

The changed minified test can be reduced to
old

export function ez(n, t, e) {
  var r;
  try {
      iP(this, tU(n, t, e));
  } catch (n) {
      if (nG(n = tg(n), 14)) throw r = n, new nw(r.f);
      throw n;
  }
}

new

export function ez(n, t, e) {
  try {
      iP(this, tU(n, t, e));
  } catch (n) {
      if (nG(n = tg(n), 14)) throw new nw(n.f);
      throw n;
  }
}

Copy link
Contributor

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait a minute:

--- A/app.kaleidoscope.kaleidoscope_dynamicfile_9DF500FA-7A80-4CDC-A435-EEE7EF3B114D-81211-00001730D248EF88.txt
+++ B/app.kaleidoscope.kaleidoscope_dynamicfile_B3D1C7AE-EA28-4184-BE77-406DEECA9390-81211-00001730D8548196.txt
@@ -1,10 +1,9 @@
 export function ez(n, t, e) {
-  var r;
   try {
       iP(this, tU(n, t, e));
   } catch (n) {
+      if (nG(n = tg(n), 14)) throw new nw(r.f);
-      if (nG(n = tg(n), 14)) throw r = n, new nw(r.f);
       throw n;
   }
 }
\ No newline at end of file

That throw new nw(r.f) is now an error, because r isn't assigned anymore?

@Austaras
Copy link
Member Author

Austaras commented Aug 23, 2023

Sorry, I write it wrong. It's actually new nw(n.f).

Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!


swc-bump:

  • swc_ecma_usage_analyzer

@kdy1 kdy1 changed the title refact(es/minifier): Pre calculate reassigned refactor(es/minifier): Pre-calculate reassigned Aug 24, 2023
@kdy1 kdy1 enabled auto-merge (squash) August 24, 2023 07:20
@kdy1 kdy1 merged commit 65db1ba into swc-project:main Aug 24, 2023
128 of 131 checks passed
@kdy1 kdy1 added this to the v1.3.79 milestone Sep 13, 2023
kdy1 added a commit that referenced this pull request Sep 25, 2023
**Description:**


x-ref: https://vercel.slack.com/archives/C02HY34AKME/p1695334071194139


Reproduction: https://github.com/kdy1/repro-test-mdx-korean



Regression of next.js: `v13.4.11`(swc_core@v0.79.13) => `v13.5.2`
(swc_core@v0.83.12)


 - `next@v13.4.19` works (swc_core@v0.79.59)
 - `next@v13.4.20-canary.3` works (swc_core@v0.79.70)
 -  **`next@v13.4.20-canary.32` fails** (swc_core@v0.83.12)

Commit range:
662f236...e67bf05

- `swc_core@v0.79.70`:
662f236
- `swc_core@v0.83.12`:
e67bf05

Diff: https://gist.github.com/kdy1/047e7e5537c34180d446cb3d5b95fce8

---

I did more investigation by monkey-patching the `next` package.
`.minify()` resolved without an exception.
It means that `.minify()` is producing an invalid ES code.

So... candidates are

 - #7890
 - #7876
 - #7858
 - #7856
 - #7853
 - #7832
@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants