Registry / web-framework / vite-plugin-meta-tags

vite-plugin-meta-tags

JSON →
library0.1.4jsnpmunverified

A Vite plugin (v0.1.4) that automatically injects meta tags (title, description, Open Graph, Twitter Card, theme color) into your index.html. It is lightweight, ships TypeScript types, and supports custom tags and environment variable integration. Active development with rapid releases. Differentiator: focused solely on meta injection with zero-config defaults for common SEO tags, unlike broader HTML-transform plugins.

npm install vite-plugin-meta-tags
INSTALL
IMPORT
SIG · VITE-PLUGIN-META-T
V
vite-plugin-meta-tags
web-frameworkjavascriptv0.1.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

meta
import { meta } from 'vite-plugin-meta-tags'
const meta = require('vite-plugin-meta-tags')
Named export; also ESM-only (package has no CJS export). Using require() will fail.
MetaInput
import type { MetaInput } from 'vite-plugin-meta-tags'
TypeScript users can import the options type for type safety.
meta (default import)
import meta from 'vite-plugin-meta-tags'
import { meta as defaultMeta } from 'vite-plugin-meta-tags'
Default import also works (resolves to the same named export).

Basic usage: configure meta tags in vite.config.ts. Plugin injects title, meta description, Open Graph, Twitter Card, and theme color tags.

import { defineConfig } from 'vite'; import { meta } from 'vite-plugin-meta-tags'; export default defineConfig({ plugins: [ meta({ title: 'My App', description: 'A description of my app', url: 'https://example.com', img: '/og-image.png', color: '#663399', }), ], });
Debug
Known issues
deprecatedThe `enfore` and `transform` options were deprecated in v0.1.4.
fix
Upgrade to v0.1.4 or later; remove these options from your config.
affects: >=0.1.0 <0.1.4
gotchaIf you don't set `type: "module"` in package.json, you may get a 'change to a dynamic import()' error when importing the plugin.
fix
Add '"type": "module"' to your package.json, or use a .mjs extension for your config file.
affects: >=0.1.0
breakingIn v0.1.2, custom tags ordering changed: custom tags are now appended first (before default tags).
fix
If you relied on custom tags being last, update your tag order logic after upgrading to v0.1.2+.
affects: >=0.1.0 <0.1.2
Errors
Common errors & fixes
Error: 'meta' is not exported from 'vite-plugin-meta-tags'
Using a CommonJS require() on an ESM-only package, or using a bundler that cannot resolve named exports from ESM.
fix
Use ES module imports: `import { meta } from 'vite-plugin-meta-tags'`. Add '"type": "module"' to package.json if needed.
Cannot read properties of undefined (reading 'meta')
Missing or incorrect Vite plugin configuration (e.g., not wrapping meta() in an array or missing import).
fix
Ensure `import { meta } from 'vite-plugin-meta-tags'` is at the top of your vite.config and use `plugins: [meta({...})]`.
Upgrade
Version history
0.1.4latest on npm
Audit
Dependencies
viterequiredpeer dependency; required as the plugin runs in Vite's build pipeline
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
vite-plugin-meta-tags — npm install vite-plugin-meta-tags · libregistry