Registry / observability / vite-plugin-performance

vite-plugin-performance

JSON →
library2.0.1jsnpmunverified

A utility to wrap Vite plugins and measure lifecycle hook execution time, helping identify build performance bottlenecks. Current stable version is 2.0.1, released as part of the weapp-vite monorepo. It supports wrapping single or array of plugins, allows filtering by hook name or threshold, and provides custom logging, formatting, and callback for integration with monitoring systems. Compatible with async hooks. The default hook list covers common Vite plugin hooks like `transform`, `load`, `resolveId`. Differentiators: lightweight, zero-config start, but also flexible for advanced use; includes a built-in default hook list and supports `'all'` to wrap every function hook.

npm install vite-plugin-performance
INSTALL
IMPORT
SIG · VITE-PLUGIN-PERFOR
V
vite-plugin-performance
observabilityjavascriptv2.0.1
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.

wrapPlugin
import { wrapPlugin } from 'vite-plugin-performance'
const wrapPlugin = require('vite-plugin-performance')
Package is ESM-only; CJS require will fail. Node >=20.19.0 or >=22.12.0 required.
DEFAULT_PLUGIN_HOOKS
import { DEFAULT_PLUGIN_HOOKS } from 'vite-plugin-performance'
import { defaultPluginHooks } from 'vite-plugin-performance'
Named export is all-uppercase with underscores.
PluginHookName
import type { PluginHookName } from 'vite-plugin-performance'
import { PluginHookName } from 'vite-plugin-performance'
PluginHookName is a type only; importing it as a value causes runtime error.

Wraps vite-plugin-inspect with performance tracking, logging hooks longer than 50ms.

import { defineConfig } from 'vite' import Inspect from 'vite-plugin-inspect' import { wrapPlugin } from 'vite-plugin-performance' export default defineConfig({ plugins: [ wrapPlugin(Inspect(), { threshold: 50, onHookExecution({ pluginName, hookName, duration }) { console.log(`[${pluginName}] ${hookName} took ${duration}ms`) }, }), ], })
Debug
Known issues
breakingvite-plugin-performance is ESM-only starting from v2.0.0. Using require() will throw a Module not found error.
fix
Use ESM imports and set type: module in package.json or use .mjs extension.
affects: >=2.0.0
breakingNode.js version requirement: ^20.19.0 || >=22.12.0. Older versions (e.g., Node 18) are not supported and may cause runtime errors.
fix
Upgrade Node to ^20.19.0 or >=22.12.0.
affects: >=2.0.0
gotchaThe `silent` option was previously misspelled as `slient`. In v2.0.0+, `slient` is still supported but deprecated. If both `silent` and `slient` are provided, `silent` takes precedence.
fix
Use `silent` instead of `slient` in options.
affects: >=2.0.0
deprecatedThe `slient` option (misspelling) will be removed in a future major version.
fix
Replace `slient` with `silent`.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: plugin.watchChange is not a function
wrapPlugin() may be called on a plugin object that does not have the expected hook methods (e.g., array input not flattened correctly).
fix
Ensure you pass either a single plugin object or an array of plugin objects. If passing an array, validate all elements are valid plugins.
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported
Using CommonJS require() to import an ESM-only package.
fix
Use import syntax instead of require(). Set type: module in package.json or rename file to .mjs.
Module not found: Can't resolve 'vite-plugin-performance'
Package not installed or path incorrect.
fix
Run pnpm add -D vite-plugin-performance (or npm/yarn) and ensure the import path matches.
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
43 hits · last 30 days
node
38
OpenAI (training)
1
Resources
vite-plugin-performance — npm install vite-plugin-performance · libregistry