vite-plugin-banner weekly downloads statistics
By chengpeiquan · npm · Vite plugins
A banner plugin for Vite. Adds a banner to the top of each generated chunk.
vite-plugin-banner has 44,534 recorded weekly downloads on npm, an increase of 2.5% over the past 30 days, ranking #817 of 3,247 tracked listings.
About vite-plugin-banner
English | 简体中文
Features
Adds a banner to the top of each generated chunk.
Installation
Install the package from npm (or yarn, or pnpm).
npm install -D vite-plugin-banner
Options
| Plugin Options Type | Description | Example |
|---|---|---|
| string | The banner content | Basic usage |
| ContentCallback | See the type declarations below | Add different banners |
| BannerPluginOptions | See the type declarations below | Optional parameter format |
· Type Declarations:
/**
* Some options from `vite.config.[ts|js]`
* @since 0.2.0
*/
export interface BannerPluginOptions {
/**
* The comment content of the banner
*
* @since ^0.6.0 support for `ContentCallback` types
*/
content: string | ContentCallback
/**
* The output directory from the configuration of Vite.js
*
* @see https://vitejs.dev/config/build-options.html#build-outdir
*
* @default viteConfig.build.outDir
*/
outDir?: string
/**
* Whether to print error messages to the console
*
* @since 0.4.0
*
* @default false
*/
debug?: boolean
/**
* By default, the validity of the content will be verified.
*
* If set to `false`, no verification will be performed.
*
* @see https://github.com/chengpeiquan/vite-plugin-banner/issues/13
*
* @since 0.5.0
*
* @default true
*/
verify?: boolean
}
/**
* Callback function to get the contents to be injected.(or not inject)
*
* @since 0.6.0
*
* @param fileName - The name of the file currently being processed
*
* @returns
* 1. When a valid string is returned, it will become the banner content
* 2. Returning a Falsy value will skip processing(e.g. `''`, `null`, `undefined`)
*
* @example
*
* ```ts
* content: (fileName: string) => {
* // Or use switch statement
* return fileName.endsWith('.js')
* ? 'This message will inject into `js` files.'
* : 'This message will inject into other files.'
* }
* ```
*/
export type ContentCallback = (fileName: string) => string | null | undefined
Usage
In most cases, just use the string format as a plugin option.
Basic usage
Add it to vite.config.ts
// vite.config.ts
import banner from 'vite-plugin-banner'
// Other dependencies...
export default defineConfig({
plugins: [banner('This is the banner content.')],
})
When you run npm run build on your project, In the dist folder(Or the build.outDir in vite.config.ts you configured), Except for vendor files, all js and css files will add a banner to the top.
e.g. in app.b3a7772e.js:
/* This is the banner content. */
var e=Object.assign;import{M as t,d as a,u as r,c......
Advanced usage
Of course, the most ideal banner is related to your package information.
First, You need to update your package.json like this, For example, it contains such field content:
{
"name": "chengpeiquan.com",
"version": "0.1.0",
"description": "My personal website, technology stack based on Vue.js 3.0, and Vite 2.0, use Server Side Generation.",
"author": "chengpeiquan",
"homepage": "https://chengpeiquan.com/"
}
Then, import the package.json into vite.config.ts, update the banner like this:
// vite.config.ts
import pkg from './package.json'
// Other dependencies...
export default defineConfig({
plugins: [
banner(
`/**\n * name: ${pkg.name}\n * version: v${pkg.version}\n * description: ${pkg.description}\n * author: ${pkg.author}\n * homepage: ${pkg.homepage}\n */`,
),
],
})
Run npm run build, you can see the banner become more detailed.
e.g. in app.6936be52.js:
/**
* name: chengpeiquan.com
* version: v0.1.0
* description: My personal website, technology stack based on Vue.js 3.0, and Vite 2.0, use Server Side Generation.
* author: chengpeiquan
* homepage: https://chengpeiquan.com/
*/
var e=Object.assign;import{M as t,d as a,u as r,c......
Fun usage
If you want to make some banners that show your personality, you can make some interesting content from some online generators.
Such as:
Description from the npm listing.
- vite-plugin
- vite plugin
- vite banner
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (591)Similar npm Vite plugins plugins
All 20 vite-plugin-banner alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/vite-plugin-banner. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.