feat(head): improved Unhead integration - #19302
Closed
harlan-zw wants to merge 21 commits into
Closed
Conversation
|
|
harlan-zw
commented
Feb 27, 2023
| } else { | ||
| head = createHead<HeadAugmentations>(headOptions) | ||
| // only in SPA mode do we need to push the appHead client side | ||
| if (nuxtApp.ssrContext?.noSSR) { |
Contributor
Author
There was a problem hiding this comment.
Is this the correct way to check for SPA?
7 tasks
8 tasks
Member
|
@harlan-zw I think a fair amount of this has been merged in other PRs. But I think there's still some stuff here we would want to merge in, right? |
Contributor
Author
|
Thanks for the ping. I'll close for now and create separate PRs where appropriate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
unjs/unhead#116, #15668
❓ Type of change
📚 Description
Unhead v1.1.0 was recently released.
With the dep update, I figure it's a good time to improve the integration:
PR To Do
Features
Dropping @vueuse/head dependency
To avoid breaking a bunch of third-party packages, the dependency was kept on @vueuse/head, which acted as a simple compatibility wrapper for Unhead. While we still need some support for this, Unhead now exports the compatibility layer directly.
This gives finer control over what's imported, allowing for better tree-shaking. For example,
@unhead/domshould be treeshaken from the server build now.Support app.head.options
While there are minimal build-time options available for Unhead, this is needed to enable
experimentalHashHydrationwhich I'm going to enable fornuxt-unhead. It will be enabled in the future by default but want to test it out a bit first.SSR: Skip app.head entry client-side
This provides a performance improvement for SSR apps, fixes the bug unjs/unhead#116 and allows for
experimentalHashHydration.New composables
useServerSeoMeta - Basically what was already available but it provides a
{ mode: 'server' }which allows for the experimental hash hydrationuseHeadSafe / useServerHeadSafe - Bit verbose having both but we need the server function for the above and to treeshake it from the client build (once the vite plugin is implemented)
Unhead Unplugin
Todo (subsequent PRs?)
The following items are things I'd like to solve but I don't think can exist within this PR.
Expose Unhead Hooks
These are pretty easy to implement but not sure if this PR is the best spot for them. They're currently not documented within the Unhead docs so should probably sort that out first.
Document Template Params
These are mainly used for lower-level integrations at this point.
📝 Checklist