---
title: "Migrate to v2"
description: "Migrate from Unhead v1 to v2. Covers subpath exports, removed implicit context, opt-in plugins, and more."
canonical_url: "https://unhead.unjs.io/docs/migration-guide/v2"
last_updated: "2026-06-11T02:05:05.190Z"
---

With the release of Unhead v2, we now have first-class support for other frameworks. This guide covers the v1 to v2 migration.

## Client / Server Subpath Exports

🚦 Impact Level: **Critical**

**⚠️ Breaking Changes:**

- `createServerHead()` and `createHead()` exports from `unhead` are removed

The path where you import `createHead` from has been updated to be a subpath export.

**Client bundle:**

```diff
-import { createServerHead } from 'unhead'
+import { createHead } from 'unhead/client'

// avoids bundling server plugins
createHead()
```

**Server bundle:**

```diff
-import { createServerHead } from 'unhead'
+import { createHead } from 'unhead/server'

// avoids bundling server plugins
-createServerHead()
+createHead()
```

---

## Removed Implicit Context

🚦 Impact Level: **Critical**

**⚠️ Breaking Changes:**

- `getActiveHead()`, `activeHead` exports are removed

The implicit context implementation kept a global instance of Unhead available so that you could use the `useHead()` composables anywhere in your application.

In v2, the core composables no longer have access to the Unhead instance. Instead, you must pass the Unhead instance to the composables.

<note>

Passing the instance is only relevant if you're importing from `unhead`. In JavaScript frameworks we tie the context to the framework itself so you don't need to worry about this.

</note>

```ts [TypeScript v2]
import { useHead } from 'unhead'

// example of getting the instance
const unheadInstance = useMyApp().unhead
useHead(unheadInstance, {
  title: 'Looks good'
})
```

---

## Removed `vmid`, `hid`, `children`, `body`

🚦 Impact Level: **High**

For legacy support with Vue Meta we allowed end users to provide deprecated properties: `vmid`, `hid`, `children` and `body`.

You must update these properties to the appropriate replacement or remove them. See the [v3 migration guide](/docs/migration-guide/v3#legacy-property-names) for the replacements.

---

## Opt-in Template Params & Tag Alias Sorting

🚦 Impact Level: **High**

To reduce the bundle size and improve performance, we've moved the template params and tag alias sorting to optional plugins.

```ts
import { AliasSortingPlugin, TemplateParamsPlugin } from 'unhead/plugins'

createHead({
  plugins: [TemplateParamsPlugin, AliasSortingPlugin]
})
```

---

## Promise Input Support

🚦 Impact Level: **Medium**

If you have promises as input they will no longer be resolved, either await the promise before passing it along or register the optional promises plugin.

```ts
import { PromisePlugin } from 'unhead/plugins'

const unhead = createHead({
  plugins: [PromisePlugin]
})
```

---

## Updated `useScript()`

🚦 Impact Level: **High**

**⚠️ Breaking Changes:**

- Script instance is no longer augmented as a proxy and promise
- `script.proxy` is rewritten for simpler, more stable behavior
- `stub()` and runtime hook `script:instance-fn` are removed

**Replacing promise usage**

```diff
const script = useScript()

-script.then(() => console.log('loaded')
+script.onLoaded(() => console.log('loaded'))
```

**Replacing proxy usage**

```diff
const script = useScript('..', {
  use() { return { foo: [] } }
})

-script.foo.push('bar')
+script.proxy.foo.push('bar')
```

---

## Tag Sorting Updated

🚦 Impact Level: **Low**

[Capo.js](https://rviscomi.github.io/capo.js/) sorting is now the default. You can opt-out:

```ts
createHead({
  disableCapoSorting: true,
})
```

---

## Default SSR Tags

🚦 Impact Level: **Low**

When SSR Unhead will now insert important default tags for you:

- `<meta charset="utf-8">`
- `<meta name="viewport" content="width=device-width, initial-scale=1">`
- `<html lang="en">`

```ts
import { createHead } from 'unhead/server'

// disable when creating the head instance
const head = createHead({
  disableDefaults: true,
})
```

---

## CJS Exports Removed

🚦 Impact Level: **Low**

CommonJS exports have been removed in favor of ESM only.

```diff
-const { createHead } = require('unhead/client')
+import { createHead } from 'unhead/client'
```

---

## Deprecated `@unhead/schema`

🚦 Impact Level: **Low**

The `@unhead/schema` package is deprecated. Import from `unhead/types` or `unhead` instead.

```diff
-import { HeadTag } from '@unhead/schema'
+import { HeadTag } from 'unhead/types'
```
