vite-plugin-time-reporter
raw JSON → 2.3.0 verified Mon Apr 27 auth: no javascript
A Vite plugin that reports build and dev server startup times. Current version 2.3.0 supports Vite 2,3,4,5 and is ESM+CJS dual-package (ESM-only since v2.2.0). Ships TypeScript types, requires Node >=18. Reports elapsed time for each plugin and total build time in a clean console output. Minimal configuration, no external dependencies beyond Vite as a peer dependency.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported ↓
cause Using require() on v2.2.0+ which is ESM-only.
fix
Change to
import timeReporter from 'vite-plugin-time-reporter' or use dynamic import. error Cannot find module 'vite-plugin-time-reporter' ↓
cause Package not installed or not resolved due to missing exports field support.
fix
Install as dev dependency:
npm install --save-dev vite-plugin-time-reporter. For older bundlers, upgrade to v2.2.0+. error export 'timeReporter' (imported as 'timeReporter') was not found in 'vite-plugin-time-reporter' ↓
cause Trying to import named export 'timeReporter' from a version that only has default export (pre-v2.0.0).
fix
Use default import:
import timeReporter from 'vite-plugin-time-reporter'. Or upgrade to v2.0.0+. Warnings
breaking v2.2.0 dropped CommonJS support; require() throws ERR_REQUIRE_ESM. ↓
fix Use ESM imports (import) or dynamic import if in a CJS context.
breaking v2.0.0 switched to dual ESM/CJS package; may break bundlers that don't support `exports` field. ↓
fix Ensure your bundler supports the package.json `exports` field, or upgrade to v2.2.0+ (ESM-only).
gotcha The plugin reports times for subsequent builds (HMR) but may not show all plugin times correctly in watch mode. ↓
fix Check Vite's `--logLevel` option; the plugin respects Vite's logger verbosity.
gotcha Installing as devDependency is mandatory; production builds will error if listed in dependencies. ↓
fix Use `npm install --save-dev` (or equivalent).
Install
npm install vite-plugin-time-reporter yarn add vite-plugin-time-reporter pnpm add vite-plugin-time-reporter Imports
- default wrong
const timeReporter = require('vite-plugin-time-reporter')correctimport timeReporter from 'vite-plugin-time-reporter' - timeReporter (named) wrong
import timeReporter from 'vite-plugin-time-reporter'correctimport { timeReporter } from 'vite-plugin-time-reporter' - timeReporter (type) wrong
import { TimeReporterOptions } from 'vite-plugin-time-reporter'correctimport type { TimeReporterOptions } from 'vite-plugin-time-reporter'
Quickstart
import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';
import timeReporter from 'vite-plugin-time-reporter';
export default defineConfig({
plugins: [
vue(),
timeReporter()
]
});