
Security News
NIST Officially Stops Enriching Most CVEs as Vulnerability Volume Skyrockets
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.
vite-plugin-performance
Advanced tools
vite-plugin-performance wraps one or more Vite plugins and measures how long each lifecycle hook takes. It keeps the original behaviour intact while giving you actionable performance insights.
hooks: 'all' to cover every function hookpnpm add -D vite-plugin-performance
# or npm / yarn / bun
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 }) {
reportToAPM({ pluginName, hookName, duration })
},
}),
],
})
Whenever a hook crosses the threshold (default 0 ms) you will see output similar to:
[inspect] transform ⏱ 78.42 ms
| Option | Type | Default | Description |
|---|---|---|---|
hooks | PluginHookName[] | 'all' | DEFAULT_PLUGIN_HOOKS | Choose which hooks to wrap; pass 'all' to wrap every function hook |
threshold | number | 0 | Only hooks with a duration greater or equal to the threshold are reported |
silent | boolean | false | Disable the built-in logger |
logger | (message, context) => void | console.log | Custom log writer |
formatter | (context) => string | [plugin] transform ⏱ 12.34 ms | Custom message formatter |
onHookExecution | (context) => void | undefined | Callback invoked after a hook finishes |
clock | () => number | performance.now or Date.now | High-resolution timer, handy for tests |
The legacy misspelled option
slientis still recognised and mapped tosilent.
import { DEFAULT_PLUGIN_HOOKS } from 'vite-plugin-performance'
// [
// 'options',
// 'config',
// 'configResolved',
// 'configureServer',
// 'buildStart',
// 'resolveId',
// 'load',
// 'transform',
// 'buildEnd',
// 'generateBundle',
// 'renderChunk',
// 'writeBundle',
// ]
const pluginA = ...
const pluginB = ...
export default defineConfig({
plugins: wrapPlugin([pluginA, pluginB], { threshold: 20 }),
})
wrapPlugin(plugin, {
formatter({ pluginName, hookName, duration }) {
return `${pluginName}:${hookName} took ${duration}ms`
},
logger(message) {
myLogger.info(message)
},
})
wrapPlugin(plugin, {
hooks: ['resolveId', 'load', 'transform'],
})
pnpm --filter vite-plugin-performance test
MIT
FAQs
vite-plugin-performance
We found that vite-plugin-performance demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.