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: remove optional chaining #10792

Merged
merged 1 commit into from Apr 29, 2024

Conversation

skirtles-code
Copy link
Contributor

Based on #4882 (comment), I believe optional chaining is avoided due to its impact on bundle size. Some recent changes have used the ?. operator, so I have removed them here.

I have only removed instances that had an impact on the size of vue.global.prod.js. Code for SSR or tests or dev hasn't been changed. While some of the replacement code looks a bit verbose, I have confirmed that each change does reduce the size of the unzipped vue.global.prod.js.

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.7 kB (-52 B) 34.5 kB (-34 B) 31.1 kB (+3 B)
vue.global.prod.js 148 kB (-158 B) 53.7 kB (-92 B) 48 kB (-99 B)

Usages

Name Size Gzip Brotli
createApp 50.7 kB (-15 B) 19.8 kB (-10 B) 18.1 kB (-14 B)
createSSRApp 54.1 kB (-15 B) 21.2 kB (-10 B) 19.3 kB (-12 B)
defineCustomElement 53 kB (-15 B) 20.6 kB (-10 B) 18.8 kB (-32 B)
overall 64.4 kB (-55 B) 24.9 kB (-32 B) 22.6 kB (-9 B)

@yyx990803 yyx990803 merged commit d00632b into vuejs:main Apr 29, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants