Skip to content

fix(es/minifier): Disable IIFE invoke when there's eval - #11984

Merged
Donny/강동윤 (kdy1) merged 2 commits into
swc-project:mainfrom
Austaras:main
Jul 4, 2026
Merged

fix(es/minifier): Disable IIFE invoke when there's eval#11984
Donny/강동윤 (kdy1) merged 2 commits into
swc-project:mainfrom
Austaras:main

Conversation

@Austaras

@Austaras Austaras commented Jul 4, 2026

Copy link
Copy Markdown
Member

Description:
See comment.

And I still don't really understand why this works in transform but not minify

BREAKING CHANGE:

Related issue (if exists):
#11977

@Austaras
Austaras requested a review from a team as a code owner July 4, 2026 09:30
@changeset-bot

changeset-bot Bot commented Jul 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d3a9d72

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ef9efe9c2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

Comment thread crates/swc_ecma_minifier/src/compress/optimize/iife.rs
@codspeed-hq

codspeed-hq Bot commented Jul 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 189 untouched benchmarks
⏩ 61 skipped benchmarks1


Comparing Austaras:main (d3a9d72) with main (26d8a28)2

Open in CodSpeed

Footnotes

  1. 61 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (9c8e6f3) during the generation of this report, so 26d8a28 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@kdy1
Donny/강동윤 (kdy1) requested a review from a team as a code owner July 4, 2026 12:09

@kdy1 Donny/강동윤 (kdy1) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@kdy1
Donny/강동윤 (kdy1) merged commit eabe4be into swc-project:main Jul 4, 2026
61 of 62 checks passed
@github-actions github-actions Bot added this to the Planned milestone Jul 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3a9d728aa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

.unwrap()
.contains(ScopeData::HAS_EVAL_CALL)
{
return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard eval before simple-return fast path

This eval rejection only runs when can_extract_param is reached, but can_inline_fn_like returns true first for single-statement simple returns (lines 993-997). In a scope flagged with HAS_EVAL_CALL, an IIFE such as (function (x) { return x; })(foo()) can still be inlined; for a non-literal argument inline_fn_param may emit a new var/assignment in the eval-visible scope, which direct eval could observe and which this patch is trying to prevent. Move the eval rejection ahead of that fast path or make the fast path prove it will not introduce a parameter binding.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot modified the milestones: Planned, v1.15.46 Jul 19, 2026
@swc-project swc (swc-project) locked as resolved and limited conversation to collaborators Aug 18, 2026
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.

2 participants