--- name: unhead-vue-skilld description: Full-stack manager for Vue (@unhead/vue 3.x). Use when writing, reviewing, or debugging code that imports @unhead/vue, calls useHead, useSeoMeta, useHeadSafe, useScript, injectHead, createHead, or sets up Unhead SSR / streaming SSR / build plugins in a Vue app. --- # @unhead/vue 3.4.1 Full-stack `` management for Vue 3. ESM only (`"type": "module"`), no CJS. Peer deps: `vue >= 3.5.18`; optional `vite >= 6.4.2`, `webpack >= 5.0.0` (source: `package.json:138-150`). Vue 2: not supported; use `@unhead/vue@^1`. Nuxt: Unhead is integrated already; do not install or set it up manually. ## Setup (mandatory) Install `@unhead/vue`, create the head instance, and register it as a Vue plugin. `createHead` comes from a subpath export, not the package root. ```ts // entry-client.ts (SPA or hydration) import { createHead } from '@unhead/vue/client' import { createApp } from './main' const { app } = createApp() const head = createHead() app.use(head) app.mount('#app') ``` ```ts // entry-server.ts (SSR) import { createHead } from '@unhead/vue/server' import { renderToString } from 'vue/server-renderer' import { createApp } from './main' export async function render(url: string) { const { app } = createApp() const head = createHead() app.use(head) const html = await renderToString(app) return { html, head } // render tags later with transformHtmlTemplate(head, template) } ``` Full SSR template wiring, streaming SSR, Options API, and auto-imports: [references/setup.md](references/setup.md). ## Composables All imported from `@unhead/vue` root and used inside `setup()`: ```vue ``` ```ts // Third-party scripts import { useScript } from '@unhead/vue' const { proxy, onLoaded, status } = useScript( { src: 'https://example.com/analytics.js' }, { use: () => window.analytics, trigger: 'client' }, ) proxy.track('pageview') // queued until the script loads ``` Details, options tables, and recipes: [references/composables.md](references/composables.md). ## Critical rules 1. **Async context**: calling `useHead()` after an `await` inside `onMounted()`/watchers throws `useHead() was called without provide context`. Fix, in order of preference: top-level `await` in `