@laynezh/vite-plugin-lib-assets weekly downloads statistics
By laynezh · npm · Vite plugins
A Vite Plugin extracts resource files referenced in library mode instead of embedded them as base64.
@laynezh/vite-plugin-lib-assets has 14,741 recorded weekly downloads on npm, a decrease of 48.3% over the past 30 days, ranking #861 of 2,322 tracked listings.
About @laynezh/vite-plugin-lib-assets
English | 中文
@laynezh/vite-plugin-lib-assets
A Vite Plugin extracts resource files referenced in library mode instead of embedded them as base64.
Install
npm i @laynezh/vite-plugin-lib-assets -D
Or
yarn add @laynezh/vite-plugin-lib-assets -D
Or
pnpm add @laynezh/vite-plugin-lib-assets -D
Usage
// vite.config.ts
import libAssetsPlugin from '@laynezh/vite-plugin-lib-assets'
export default defineConfig({
plugins: [
libAssetsPlugin({ /* options */ }),
],
})
Example: playground/
Hints
- If
build.ssris set totrue, you might want to enablebuild.ssrEmitAssets, so assets are emitted.
Option
export interface Options {
include?: string | RegExp | (string | RegExp)[]
exclude?: string | RegExp | (string | RegExp)[]
name?: string
limit?: number
outputPath?: string | ((url: string, resourcePath: string, resourceQuery: string) => string)
regExp?: RegExp
publicUrl?: string
}
include
A valid picomatch pattern, or array of patterns indicate which files need to be handled by the plugin.
- Type:
string | RegExp | (string | RegExp)[] - Default: Same as Vite's default value for
assetsInclude, you can find the complete list here. - Example:
libAssetsPlugin({ include: /\.a?png(\?.*)?$/ })
exclude
Same as include, but it is used to indicate the files that should to be omitted.
- Type:
string | RegExp | (string | RegExp)[] - Default:
undefined. - Example:
libAssetsPlugin({ exclude: /\.svg(\?.*)?$/ })
name
Output name of the resource file, its usage aligns with the name option of the file-loader.
- Type:
string - Default:
'[contenthash].[ext]' - Example:
libAssetsPlugin({ name: '[name].[contenthash:8].[ext][query]' })
The complete list can be found at
loader-utils#interpolatename
limit
Files larger than the limit will be extracted to the output directory, smaller files will remain embedded in the artifact in base64 format.
- Type:
number,unitByte - Default:
undefined,any size of resource files will be extracted - Example:
libAssetsPlugin({ limit: 1024 * 8 // 8KB })
outputPath
Specify the output path where the extracted files will be placed.
- Type:
string | ((url: string, resourcePath: string, resourceQuery: string) => string) - Default:
Vite'sassetsDirconfiguration. - Example:
stringlibAssetsPlugin({ outputPath: 'images' })functionlibAssetsPlugin({ outputPath: (url, resourcePath, resourceQuery) => { // `url` - file name processed by the `name` option,eg: `logo.fb2133.png` // `resourcePath` - `/original/absolute/path/to/file.js` // `resourceQuery` - `?foo=bar` return url.endsWith('.png') ? 'image' : 'assets' }, })
regExp
Specifies a Regular Expression to extract parts of content(capture groups) from the file path and use [N] as placeholders in the name for replacement. Its usage aligns with the regexp option of the file-loader.
- Type:
RegExp - Default:
undefined - Example:
libAssetsPlugin({ regExp: /\/([^/]+)\/[^\.]+.png$/, name: '[1]-[name].[contenthash:8].[ext]' })
publicUrl
Access path prefix for built resource files. Once provided, it will take effect, even while building the cjs and esm formats.
- Type:
string - Default:
'' - Example:
libAssetsPlugin({ publicUrl: 'https://cdn.jsdelivr.net/npm/@laynezh/vite-plugin-lib-assets' })
Description from the npm listing.
- vite-plugin
- vite
- generate lib assets
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 (122)Similar npm Vite plugins plugins
All 20 @laynezh/vite-plugin-lib-assets 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/@laynezh/vite-plugin-lib-assets. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.