fix(es/minifier): Disable IIFE invoke when there's eval - #11984
Conversation
🦋 Changeset detectedLatest 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 |
There was a problem hiding this comment.
💡 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".
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
💡 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; |
There was a problem hiding this comment.
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 👍 / 👎.
Description:
See comment.
And I still don't really understand why this works in
transformbut notminifyBREAKING CHANGE:
Related issue (if exists):
#11977