Build Plugins · Unhead

[Unhead Home](https://unhead.unjs.io/ "Home")

- [Docs](https://unhead.unjs.io/docs/typescript/head/guides/get-started/overview)
- [Tools](https://unhead.unjs.io/tools)
- [Learn](https://unhead.unjs.io/learn/guides/what-is-capo)

[Releases](https://unhead.unjs.io/releases)

Search…```k`` /`

[Unhead on GitHub](https://github.com/unjs/unhead)

[User Guides](https://unhead.unjs.io/docs/typescript/head/guides/get-started/overview)

[API](https://unhead.unjs.io/docs/typescript/head/api/get-started/overview)

[Releases](https://unhead.unjs.io/docs/typescript/releases/v3)

TypeScript

- [Switch to TypeScript](https://unhead.unjs.io/docs/typescript/head/guides/build-plugins/overview)
- [Switch to Vue](https://unhead.unjs.io/docs/vue/head/guides/build-plugins/overview)
- [Switch to React](https://unhead.unjs.io/docs/react/head/guides/build-plugins/overview)
- [Switch to Svelte](https://unhead.unjs.io/docs/svelte/head/guides/build-plugins/overview)
- [Switch to Solid.js](https://unhead.unjs.io/docs/solid-js/head/guides/build-plugins/overview)
- [Switch to Angular](https://unhead.unjs.io/docs/angular/head/guides/build-plugins/overview)
- [Switch to Nuxt](https://unhead.unjs.io/docs/nuxt/head/guides/build-plugins/overview)

v3 (stable)

Head

- [Discord Support](https://discord.com/invite/275MBUBvgP)
- [TypeScript Playground](https://stackblitz.com/edit/github-hhxywsb5)

- Get Started
  - [Overview](https://unhead.unjs.io/docs/typescript/head/guides/get-started/overview)
  - [Introduction to Unhead](https://unhead.unjs.io/docs/typescript/head/guides/get-started/intro-to-unhead)
  - [Starter Recipes](https://unhead.unjs.io/docs/typescript/head/guides/get-started/starter-recipes)
- Core Concepts
  - [Titles & Title Templates](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/titles)
  - [Tag Sorting & Placement](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/positions)
  - [Class & Style Attributes](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/class-attr)
  - [Inline Style & Scripts](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/inner-content)
  - [Tag Deduplication](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/handling-duplicates)
  - [DOM Event Handling](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/dom-event-handling)
  - [Script Loading](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/loading-scripts)
- Build Plugins
  - [Overview](https://unhead.unjs.io/docs/typescript/head/guides/build-plugins/overview)
  - [Tree-Shaking](https://unhead.unjs.io/docs/typescript/head/guides/build-plugins/tree-shaking)
  - [useSeoMeta Transform](https://unhead.unjs.io/docs/typescript/head/guides/build-plugins/seo-meta-transform)
  - [Minify Transform](https://unhead.unjs.io/docs/typescript/head/guides/build-plugins/minify-transform)
  - [Devtools](https://unhead.unjs.io/docs/typescript/head/guides/build-plugins/devtools)
- Plugins
  - [Template Params](https://unhead.unjs.io/docs/typescript/head/guides/plugins/template-params)
  - [Alias Sorting](https://unhead.unjs.io/docs/typescript/head/guides/plugins/alias-sorting)
  - [Canonical Plugin](https://unhead.unjs.io/docs/typescript/head/guides/plugins/canonical)
  - [Infer SEO Meta](https://unhead.unjs.io/docs/typescript/head/guides/plugins/infer-seo-meta-tags)
  - [Minify](https://unhead.unjs.io/docs/typescript/head/guides/plugins/minify)
  - [Validate](https://unhead.unjs.io/docs/typescript/head/guides/plugins/validate)

Build Plugins

# Build Plugins

Last updated Apr 9, 2026 by [Harlan Wilton](https://github.com/harlan-zw) in [feat(devtools): vite devtools integration (#731)](https://github.com/unjs/unhead/pull/731).

On this page

- [Setup](#setup)
- [What Does It Do?](#what-does-it-do)
- [Options](#options)
- [Webpack](#webpack)

**Quick Answer:** Each framework package ships a unified Vite plugin at `@unhead/{framework}/vite` that handles build optimizations. One import, one plugin call.

## [Setup](#setup)

Install your framework's unhead package (if you haven't already), then add the plugin to your Vite config:

Vue

React

Svelte

Solid.js

Nuxt

vite.config.ts

```
import vue from '@vitejs/plugin-vue'
import { Unhead } from '@unhead/vue/vite'

export default defineConfig({
  plugins: [vue(), Unhead()],
})
```

## [What Does It Do?](#what-does-it-do)

The plugin combines several build-time optimizations:

- **[Tree-shaking](https://unhead.unjs.io/docs/head/guides/build-plugins/tree-shaking)**: Removes deprecated server composables and `useSchemaOrg` calls from client bundles
- **[useSeoMeta transform](https://unhead.unjs.io/docs/head/guides/build-plugins/seo-meta-transform)**: Converts `useSeoMeta()` calls into raw `useHead()` calls at build time (~3kb savings)
- **[Minify transform](https://unhead.unjs.io/docs/head/guides/build-plugins/minify-transform)**: Pre-minify static inline script/style content at build time
- **Dev validation**: Auto-injects `ValidatePlugin` in dev so head tag warnings surface in the browser console (enabled by default)
- **[Devtools](https://unhead.unjs.io/docs/head/guides/build-plugins/devtools)**: Inspect head tags, entries, and SEO metadata in Vite DevTools (dev only, enabled by default)

## [Options](#options)

```
Unhead({
  // Disable server composable tree-shaking
  treeshake: false,
  // Disable useSeoMeta → useHead transform
  transformSeoMeta: false,
  // Pre-minify inline script/style content
  minify: { js: createJSMinifier(), css: createCSSMinifier() },
  // File filter (shared across all transforms)
  filter: { exclude: [/some-file/] },
})
```

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `treeshake` | `object \| false` | enabled | [Tree-shake server composables](https://unhead.unjs.io/docs/head/guides/build-plugins/tree-shaking) from client bundles |
| `transformSeoMeta` | `object \| false` | enabled | [Transform `useSeoMeta()`](https://unhead.unjs.io/docs/head/guides/build-plugins/seo-meta-transform) to `useHead()` |
| `minify` | `object \| false` | disabled | [Pre-minify static inline script/style](https://unhead.unjs.io/docs/head/guides/build-plugins/minify-transform) |
| `validate` | `boolean` | enabled | Auto-inject `ValidatePlugin` in dev for head tag warnings |
| `devtools` | `object \| false` | enabled | [Vite DevTools integration](https://unhead.unjs.io/docs/head/guides/build-plugins/devtools) (dev only) |
| `filter` | `object` | — | Shared include/exclude file filter |
| `sourcemap` | `boolean` | — | Enable sourcemap generation for transforms |

Every option accepts `false` to disable it entirely, or an object to configure it.

## [Webpack](#webpack)

For Webpack projects, use `@unhead/bundler/webpack` directly:

```
import { Unhead } from '@unhead/bundler/webpack'

export default {
  plugins: [Unhead()],
}
```

[Edit this page](https://github.com/unjs/unhead/edit/main/docs/head/1.guides/build-plugins/0.overview.md)

[Markdown For LLMs](https://raw.githubusercontent.com/unjs/unhead/refs/heads/main/docs/head/1.guides/build-plugins/0.overview.md)

Did this page help you?

[Script Loading Load external scripts with useScript(). Singleton deduplication, proxy for safe calls, loading triggers, and warmup strategies for performance.](https://unhead.unjs.io/docs/head/guides/core-concepts/loading-scripts) [Tree-Shaking Automatically remove server-only composables from client bundles at build time.](https://unhead.unjs.io/docs/head/guides/build-plugins/tree-shaking)

On this page

- [Setup](#setup)
- [What Does It Do?](#what-does-it-do)
- [Options](#options)
- [Webpack](#webpack)

[GitHub](https://github.com/unjs/unhead) [ Discord](https://discord.com/invite/275MBUBvgP)

[ /llms.txt](https://unhead.unjs.io/llms.txt)

[Part of the UnJS ecosystem](https://unjs.io/)

### Head Management

- [Getting Started](https://unhead.unjs.io/docs/typescript/head/guides/get-started/overview)
- [useHead](https://unhead.unjs.io/docs/typescript/head/api/composables/use-head)
- [useSeoMeta](https://unhead.unjs.io/docs/typescript/head/api/composables/use-seo-meta)
- [useHeadSafe](https://unhead.unjs.io/docs/typescript/head/api/composables/use-head-safe)
- [useScript](https://unhead.unjs.io/docs/typescript/head/api/composables/use-script)

### Schema.org

- [Getting Started](https://unhead.unjs.io/docs/typescript/schema-org/guides/get-started/overview)
- [useSchemaOrg](https://unhead.unjs.io/docs/typescript/schema-org/api/composables/use-schema-org)
- [Nodes](https://unhead.unjs.io/docs/typescript/schema-org/guides/core-concepts/nodes)
- [Recipes](https://unhead.unjs.io/docs/typescript/schema-org/guides/recipes/identity)

### Guides

- [Titles](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/titles)
- [Streaming SSR](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/streaming)
- [DOM Events](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/dom-event-handling)
- [Plugins](https://unhead.unjs.io/docs/typescript/head/guides/plugins/template-params)

### Tools

- [Meta Tag Generator](https://unhead.unjs.io/tools/meta-tag-generator)
- [OG Image Generator](https://unhead.unjs.io/tools/og-image-generator)
- [Schema.org Generator](https://unhead.unjs.io/tools/schema-generator)
- [Capo.js Analyzer](https://unhead.unjs.io/tools/capo-analyzer)

### Articles

- [What is Capo.js?](https://unhead.unjs.io/learn/guides/what-is-capo)

### Research

- [State of <head> in 2026](https://unhead.unjs.io/learn/research/state-of-head-2026)
- [Streaming Head Performance](https://unhead.unjs.io/learn/research/streaming-head-performance)
- [Capo.js Performance Research](https://unhead.unjs.io/learn/research/capo-performance-research)

Copyright © 2025-2026 Harlan Wilton - [MIT License](https://github.com/unjs/unhead/blob/main/license)