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

fix(es/minifier): Don't inline properties if the var is not fn-local #7839

Merged
merged 13 commits into from
Aug 22, 2023

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Aug 19, 2023

@kdy1 kdy1 added this to the Planned milestone Aug 19, 2023
@kdy1 kdy1 self-assigned this Aug 19, 2023
@kdy1 kdy1 changed the title fix(es/minifier): Fix a bug fix(es/minifier): Don't inline properties if the var is not fn-local Aug 19, 2023
@kdy1
Copy link
Member Author

kdy1 commented Aug 19, 2023

@Austaras @jridgewell

I think we need to improve logic for is_fn_local, but I think I should focus on fixing vercel/next.js#54192 for now

@kdy1 kdy1 marked this pull request as ready for review August 19, 2023 07:26
kodiakhq[bot]
kodiakhq bot previously approved these changes Aug 19, 2023
@kdy1 kdy1 requested a review from jridgewell August 19, 2023 07:27
Copy link
Member Author

@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.

swc-bump:

  • swc_ecma_minifier

@Austaras
Copy link
Member

Should we abort in the else block of this? It's causing many item being wrongfully inlined. For example

export function createCaseFirst(g, methodName) {
  var chr = g.get(0)
  console.log(123)
  return chr[methodName]() + trailing;
}

In this case chr cannot be inlined because of side effects.

@kdy1
Copy link
Member Author

kdy1 commented Aug 19, 2023

I reflected it 👍

kodiakhq[bot]
kodiakhq bot previously approved these changes Aug 19, 2023
kodiakhq[bot]
kodiakhq bot previously approved these changes Aug 19, 2023
@kdy1 kdy1 merged commit 7fe01e6 into swc-project:main Aug 22, 2023
131 checks passed
@kdy1 kdy1 deleted the next-54192 branch August 22, 2023 02:04
kodiakhq bot pushed a commit to vercel/next.js that referenced this pull request Aug 22, 2023
### What?

Update swc_core to `v0.79.70`

### Why?

To apply swc-project/swc#7839

### How?

Closes WEB-1420
Fixes #54192
@kdy1 kdy1 modified the milestones: Planned, v1.3.79 Aug 25, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators Sep 24, 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

4 participants