Registry / web-framework / vite-plugin-favicon2

vite-plugin-favicon2

JSON →
library1.1.5jsnpmunverified

A Vite plugin that generates favicons and PWA manifest icons from a single logo image using the favicons library. Current stable version is 1.1.5. It is a fork of the original vite-plugin-favicon that fixes issues with dev mode support, adds ability to generate webapp.html file, and re-enables outputPath configuration. The plugin is applied only during build phase to speed up dev server cold starts. It is compatible with favicons-webpack-plugin configuration.

npm install vite-plugin-favicon2
INSTALL
IMPORT
SIG · VITE-PLUGIN-FAVICO
V
vite-plugin-favicon2
web-frameworkjavascriptv1.1.5
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.

ViteFaviconsPlugin
import { ViteFaviconsPlugin } from 'vite-plugin-favicon2'
import ViteFaviconsPlugin from 'vite-plugin-favicon2'
Named export, not default.
ViteFaviconsPlugin
const { ViteFaviconsPlugin } = require('vite-plugin-favicon2')
const ViteFaviconsPlugin = require('vite-plugin-favicon2')
CommonJS destructured require.
ViteFaviconsPlugin
import { ViteFaviconsPlugin } from 'vite-plugin-favicon2'
import { ViteFaviconsPlugin } from 'vite-plugin-favicon'
Wrong package name; use 'vite-plugin-favicon2'.

Shows how to configure the plugin with a custom logo, enabling injection and setting output path.

// vite.config.js import { defineConfig } from 'vite'; import { ViteFaviconsPlugin } from 'vite-plugin-favicon2'; export default defineConfig({ plugins: [ ViteFaviconsPlugin({ logo: './src/logo.svg', inject: true, outputPath: 'favicons', }), ], });
Debug
Known issues
breakingIn v1.1.0, the plugin changed to only run during build phase, which may affect workflows that rely on dev mode favicon generation.
fix
Use inject: true to automatically inject tags; if you need dev mode support, consider using a different plugin or downgrading to older versions.
affects: >=1.1.0
deprecatedThe 'prefix', 'cache', and 'publicPath' options are deprecated and have no effect; they exist only for migration from favicons-webpack-plugin.
fix
Remove these options from your config; they are automatically handled by Vite.
affects: *
gotchaWhen using 'inject: false', the plugin generates a 'webapp.html' file instead of injecting HTML tags. Ensure your build setup includes this file (e.g., copy to output).
fix
Set inject: true for automatic injection, or manually reference the generated webapp.html in your HTML.
affects: >=1.1.0
gotchaThe 'logo' option defaults to 'assets/logo.png' from the project root. If not found, the plugin may fail silently or produce unexpected results.
fix
Specify an absolute or relative path to your logo file explicitly.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'vite-plugin-favicon2'
Missing package installation.
fix
Run 'npm install --save-dev vite-plugin-favicon2'
TypeError: ViteFaviconsPlugin is not a constructor
Using default import instead of named import.
fix
Use 'import { ViteFaviconsPlugin } from 'vite-plugin-favicon2' or const { ViteFaviconsPlugin } = require('vite-plugin-favicon2')
The plugin does not work in dev mode
Since v1.1.0, the plugin only runs during build.
fix
Use inject: true and accept that favicons won't update in dev; or use a workaround like separate dev build.
Upgrade
Version history
1.1.5latest on npm
Audit
Dependencies
viterequiredPeer dependency; plugin hooks into Vite's build system
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
vite-plugin-favicon2 — npm install vite-plugin-favicon2 · libregistry