Unhead 3.5 focuses on performance and correctness, especially when the browser picks up where the server left off.
⚡ Less work during hydration
A page can arrive with a large inline stylesheet that Unhead never needs to update. Unhead now skips building a lookup key from that CSS unless a client tag needs it. That made first hydration 23% faster in our Nuxt-style benchmark. Benchmark results
🌱 Experimental Lazy Mode
If the server already rendered all head tags your page needs, you can try the experimental lazy head. It queues changes until you call head.load(). It’s available for Vue, React, Svelte, Solid and vanilla JavaScript. Lazy head API
This work also opens the door to compiled mode. That’s an opt-in approach we’re exploring for a future release, where the build prepares head tags ahead of time.
Changelog
🚀 Features
- Opt-in lazy head - by @harlan-zw in #1063 (a464d)
- Add lazy head entries for React, Svelte and Solid - by @harlan-zw in #1079 (70e51)
- bundler: Add serverOnlyCrawlerTags option - by @harlan-zw in #1059 (8db92)
- unhead: Allow precomputing static server init entires - by @danielroe in #1029 (0bf88)
- validate: Suggest keys for large inline tags - by @harlan-zw in #1129 (05c16)
- vite: Convert Vite descriptors for SSR - by @harlan-zw in #969 (4e42f)
🐞 Bug Fixes
- angular:
- Parse rendered SSR root attributes - by @harlan-zw in #1098 (0808c)
- bundler:
- Export shared public signature types - by @harlan-zw in #1025 (a8234)
- Detach script events from devtools snapshots - by @harlan-zw in #1032 (3ccd1)
- Preserve bodies when removing server composables - by @harlan-zw in #1036 (5498d)
- ci:
- Skip stale bundle stats updates - by @harlan-zw in #1119 (93e72)
- minify:
- Preserve inline script and style semantics - by @harlan-zw in #1073 (a3833)
- schema-org:
- Accept Vue getter inputs - by @harlan-zw in #1030 (348d0)
- Keep the logo on specialized organization identities - by @vasilistotskas in #1034 (b35b0)
- Keep the site identity as the WebSite publisher - by @MFA-G in #1067 (f5a83)
- Only the identity organization inherits the site host url - by @Hayabusa-YL in #1069 (1fbe4)
- Keep unrelated people from becoming article authors - by @mayankdhingra02 in #1074 (e4975)
- Keep Event locations with a url and an address as a Place - by @magndotcc in #1071 (d5105)
- Match WebPage slugs without case sensitivity - by @harlan-zw in #1076 (bbbc4)
- Resolve relative location URLs - by @magndotcc in #1070 (a422c)
- Preserve protocol-relative URLs - by @harlan-zw in #1078 (616af)
- Scope generated counter ids to each page - by @harlan-zw in #1077 (02ba1)
- scripts:
- Preserve explicit undefined crossorigin - by @harlan-zw in #1068 (546c9)
- Hydrate server trigger scripts from the server element - by @harlan-zw in #1091 (6a788)
- unhead:
- End extracted script and style at the first closing tag - by @NgoQuocViet2001 in #1028 (65050)
- Escape control characters in JSON template parameters - by @henricop in #1039 (f3ab1)
- Keep server twitter:card when og:image is server only - by @harlan-zw in #1093 (5ec9f)
- Normalize mixed class and style arrays - by @harlan-zw in #1109 (9ef48)
- Scan SSR templates without parse5 - by @harlan-zw in #1126 (61743)
- vue:
- Type streaming server head input - by @harlan-zw in #1103 (50165)
- Accept computed preload types - by @harlan-zw in #1116 (1ed48)
🏎 Performance
- Shrink the unhead client core - by @harlan-zw in #1080 (c8590)
- Release removed untracked elements from the dom cache - by @danielroe in #1081 (c65cd)
- bench:
- Measure hydration of a Nuxt-style SSR head - by @harlan-zw in #1113 (2d49a)
- Report Fieldnote entry Brotli bytes - by @harlan-zw in #1122 (dbdc7)
- Report streaming client and bootstrap sizes - by @harlan-zw in #1124 (f54bb)
- bundler:
- Parse transforms with oxc-parser raw transfer - by @danielroe in #1075 (4817b)
- dom:
- Reduce hydration work and release stale cleanup - by @harlan-zw in #1108 (35028)
- Skip writes for unchanged attribute values - by @harlan-zw in #1131 (018f2)
- Skip indexing unused content keys during hydration - by @harlan-zw in #1136 (3423e)
- ssr:
- Skip closing-tag replacement for plain inline content - by @harlan-zw in #1130 (04514)
- Skip ampersand replacement for plain root attributes - by @harlan-zw in #1132 (525db)
- stream:
- Reduce allocations per stream read - by @harlan-zw in #1090 (14729)
- Minify the streaming bootstrap at build time - by @harlan-zw in #1123 (eb78b)
- unhead:
- Avoid the decodeURI throw in template params - by @harlan-zw in #1064 (03db6)
- Reduce head normalization work - by @harlan-zw in #1112 (c76f6)
- Reduce title template allocations - by @harlan-zw in #1117 (fa823)
- Share promise walkers - by @harlan-zw in #1120 (1a812)
- Reduce the minimal client bundle - by @harlan-zw in #1138 (b3741)
- vue:
- Shrink the client useHead path - by @harlan-zw in #1085 (95abc)