{"id":22573,"library":"vite-manifest-plugin","title":"Vite Manifest Plugin","description":"Vite plugin that modifies the manifest.json output by Vite, adding a public path prefix to file paths. Current stable version is 1.1.1, released on an irregular cadence. Key differentiator: simple, focused solution for adding public paths to Vite-generated manifests, useful for module federation or deployments where assets are served from a subdirectory. Alternative to manual manifest post-processing.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/ThanatWongsamut/vite-manifest-plugin","tags":["javascript","vite-plugin","vite plugin","module federation","typescript"],"install":[{"cmd":"npm install vite-manifest-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add vite-manifest-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-manifest-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required as a Vite plugin.","package":"vite","optional":false}],"imports":[{"note":"ESM-only package; named export.","wrong":"const viteManifestPlugin = require('vite-manifest-plugin')","symbol":"viteManifestPlugin","correct":"import { viteManifestPlugin } from 'vite-manifest-plugin'"},{"note":"TypeScript type export for options.","wrong":"","symbol":"ViteManifestPluginOptions","correct":"import type { ViteManifestPluginOptions } from 'vite-manifest-plugin'"},{"note":"Although a default export exists, the recommended usage is the named export.","wrong":"","symbol":"default export","correct":"import viteManifestPlugin from 'vite-manifest-plugin'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport { viteManifestPlugin } from 'vite-manifest-plugin';\n\nexport default defineConfig({\n  build: {\n    manifest: true,\n  },\n  plugins: [\n    viteManifestPlugin({\n      fileName: 'manifest.json',\n      publicPath: process.env.PUBLIC_PATH ?? '/static/',\n    }),\n  ],\n});","lang":"typescript","description":"Configure Vite to generate a manifest and use vite-manifest-plugin to prepend a public path to all file URLs."},"warnings":[{"fix":"Ensure build.manifest: true is set in vite.config.ts.","message":"Plugin only modifies the manifest if build.manifest is set to true in Vite config.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the same fileName value as the manifest generated by Vite (default: 'manifest.json').","message":"The fileName option must match the manifest file name Vite generates, otherwise the plugin may not find the manifest.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always include trailing slash in publicPath, e.g., '/static/'.","message":"If publicPath does not end with '/', paths may be malformed.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Set build.manifest: true in Vite config and ensure fileName matches the generated manifest name.","cause":"The file specified in fileName does not exist, or build.manifest is not enabled.","error":"Error: [vite-manifest-plugin] Manifest file not found at path/to/manifest.json"},{"fix":"Pass an options object: viteManifestPlugin({ fileName: 'manifest.json', publicPath: '/static/' })","cause":"The plugin is called without options or with undefined options.","error":"TypeError: Cannot read properties of undefined (reading 'fileName')"},{"fix":"Run: npm install vite-manifest-plugin","cause":"Package not installed or not in node_modules.","error":"Module not found: Error: Can't resolve 'vite-manifest-plugin'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}