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

perf(head): drop @vueuse/head dependency #19519

Merged
merged 13 commits into from Mar 8, 2023
Merged

Conversation

harlan-zw
Copy link
Contributor

@harlan-zw harlan-zw commented Mar 8, 2023

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Related: #19302

Switching to using Unhead directly allows for better tree-shaking (i.e @unhead/dom from server build), simplifies the code, and minimizes dependencies.

The issue with dropping the dependency is any modules or third-party code which used the pre-v1 API @vueuse/head and/or directly imported from it may break. The scope of that is quite hard to determine.

We can solve issue using a polyfill and an alias. If we're okay with potentially breaking code for some codebases relying on old low level @vueuse/head code, then we could ship without the polyfill enabled by default.

Without the polyfill, there's a 0.47kB client bundle improvement, otherwise, it's only 0.1kB. This unlocks further optimizations.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox
Copy link

codesandbox bot commented Mar 8, 2023

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@harlan-zw harlan-zw requested a review from danielroe March 8, 2023 03:45
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

Nice!

packages/nuxt/src/head/module.ts Outdated Show resolved Hide resolved
@danielroe danielroe requested review from pi0 and antfu March 8, 2023 09:35
@danielroe danielroe added this to the v3.3 milestone Mar 8, 2023
@danielroe danielroe mentioned this pull request Mar 8, 2023
@antfu
Copy link
Member

antfu commented Mar 8, 2023

πŸ‘ Nice!

Unrelated @harlan-zw: Do you think it makes sense to deprecate @vueuse/head in favor of @unhead/vue?

@harlan-zw
Copy link
Contributor Author

+1 Nice!

Unrelated @harlan-zw: Do you think it makes sense to deprecate @vueuse/head in favor of @unhead/vue?

Yup! This is planned once I sort out a couple more outstanding issues.

@harlan-zw harlan-zw changed the title fix(head): drop @vueuse/head dependency perf(head): drop @vueuse/head dependency Mar 8, 2023
@danielroe danielroe merged commit 8732720 into main Mar 8, 2023
@danielroe danielroe deleted the fix/drop-vueuse-dependency branch March 8, 2023 15:32
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

3 participants