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

optimize the production build results #292

Open
edison1105 opened this issue Nov 19, 2024 · 2 comments
Open

optimize the production build results #292

edison1105 opened this issue Nov 19, 2024 · 2 comments
Labels
good first issue Good for newcomers performance todo PR welcome

Comments

@edison1105
Copy link
Member

Note that this is not a real bug, just an optimization item.

see Playground

It seems no need to wrap it as an IIFE.

setup(__props) {
  const msg = ref('Hello World!')
  return ((_ctx) => {
    const n0 = t0()
    _setInheritAttrs(false)
    _renderEffect(() => _setText(n0, msg.value))
    return n0
  })()
}

better is:

setup(__props) {
  const msg = ref('Hello World!')
  const n0 = t0()
  _setInheritAttrs(false)
  _renderEffect(() => _setText(n0, msg.value))
  return n0
}
@vad1ym
Copy link

vad1ym commented Nov 19, 2024

Instead of msg, it could be anything, including n0, which is why there's an IIFE

@LittleSound
Copy link
Member

Instead of msg, it could be anything, including n0, which is why there's an IIFE

We can use Block Statement
Or use compiler static analysis to adapted generation result

@LittleSound LittleSound added good first issue Good for newcomers todo PR welcome performance labels Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers performance todo PR welcome
Projects
None yet
Development

No branches or pull requests

3 participants