{"id":22763,"library":"vite-plugin-open-graph","title":"vite-plugin-open-graph","description":"A Vite plugin that automatically generates Open Graph meta tags into your HTML head based on a configuration object. Current stable version is 2.0.6, targeting Vite 5+ (requires Node >=16). It supports Twitter Card, Facebook app ID, and full Open Graph protocol fields with TypeScript types included. Differentiators: simple declarative config, no runtime overhead (build-time injection), and first-class type support. Release cadence is irregular, mostly bug fixes and minor feature additions.","status":"active","version":"2.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/Lmmmmmm-bb/vite-plugin-open-graph","tags":["javascript","vite","vite-plugin","open-graph","open-graph-protocol","typescript"],"install":[{"cmd":"npm install vite-plugin-open-graph","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-open-graph","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-open-graph","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The plugin is exported as default. Named export 'ogPlugin' does not exist.","wrong":"import { ogPlugin } from 'vite-plugin-open-graph'","symbol":"default export","correct":"import ogPlugin from 'vite-plugin-open-graph'"},{"note":"Options is a type-only export; use 'import type' to avoid runtime import.","wrong":"import { Options } from 'vite-plugin-open-graph'","symbol":"Options","correct":"import type { Options } from 'vite-plugin-open-graph'"},{"note":"The default export is the plugin function. You can rename it when importing.","wrong":"import ogVitePlugin from 'vite-plugin-open-graph'; // not recommended, but works","symbol":"ogVitePlugin","correct":"import ogPlugin from 'vite-plugin-open-graph'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport ogPlugin from 'vite-plugin-open-graph';\nimport type { Options } from 'vite-plugin-open-graph';\n\nconst ogOptions: Options = {\n  basic: {\n    url: 'https://example.com',\n    title: 'Example Site',\n    type: 'website',\n    image: 'https://example.com/og-image.png',\n    description: 'A description of the site',\n    locale: 'en_US',\n    localeAlternate: ['fr_FR'],\n    siteName: 'Example',\n  },\n  twitter: {\n    card: 'summary_large_image',\n    image: 'https://example.com/twitter-image.png',\n  },\n  facebook: {\n    appId: 123456789,\n  },\n};\n\nexport default defineConfig({\n  plugins: [ogPlugin(ogOptions)],\n});","lang":"typescript","description":"Configures the plugin with basic OG meta, Twitter Card, and Facebook app ID, generating appropriate <meta> tags in the HTML head."},"warnings":[{"fix":"Upgrade Vite to version 5 or higher.","message":"v2.0.0 dropped support for Vite 4 and below; requires Vite 5 or higher.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure Node version is >=16.","message":"Node 16 is the minimum required engine since v2.0.3-beta.1; older Node versions are not supported.","severity":"breaking","affected_versions":">=2.0.3-beta.1"},{"fix":"No action needed.","message":"The 'basic' configuration field remains the primary way to set OG meta; no deprecation yet.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Install the plugin in the root node_modules or use workspaces correctly.","message":"If you use the plugin in a monorepo, ensure all dependencies are hoisted or installed properly; v2.0.4 fixed a monorepo deps issue.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Set 'basic.type' to a valid OG type; see https://ogp.me/#types.","message":"The 'type' field in 'basic' is the Open Graph type, not the HTML meta content type. It should be a valid OG type (e.g., 'website', 'article').","severity":"gotcha","affected_versions":"*"},{"fix":"Provide a fully qualified URL (absolute or relative to the site base).","message":"The 'image' field expects a URL string, not a buffer or file path.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install vite-plugin-open-graph --save-dev' (or yarn/pnpm equivalent).","cause":"Plugin not installed or not in node_modules.","error":"Module not found: Error: Can't resolve 'vite-plugin-open-graph'"},{"fix":"Use 'import ogPlugin from 'vite-plugin-open-graph'' (default import).","cause":"Named import used instead of default import.","error":"TypeError: ogPlugin is not a function"},{"fix":"Use 'import type { Options } from 'vite-plugin-open-graph''.","cause":"Trying to import Options at runtime instead of type-only.","error":"Options is not exported from 'vite-plugin-open-graph'"},{"fix":"Ensure TypeScript is configured with 'moduleResolution': 'node' (or 'bundler') and that the package is installed.","cause":"Missing types or incorrect module resolution.","error":"Cannot find module 'vite-plugin-open-graph' or its corresponding type declarations."},{"fix":"The plugin automatically injects meta tags during build. No manual generation needed.","cause":"Misunderstanding of plugin API; no separate generateMetaTags function.","error":"Error: generateMetaTags is not defined or similar runtime error"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}