{"id":18902,"library":"vite-build-monitor","title":"vite-build-monitor","description":"A Vite plugin (v1.0.5) that monitors heap and RSS memory usage during the build process. It records memory snapshots at configurable intervals, tracks peak usage per build phase, and outputs a summary of the top memory-consuming phases. The plugin supports pretty or JSON log formats, exclusion of specific hooks from logging, and optional uncaught exception capture. It requires Node >=22.0.0 and ships TypeScript declarations. Compared to generic process monitoring, this plugin provides phase-level tracking integrated with Vite's build hooks (buildStart, renderChunk, etc.).","status":"active","version":"1.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/BINGWU2003/vite-build-monitor","tags":["javascript","vite","vite-plugin","build","memory","monitor","heap","rss","diagnostics","typescript"],"install":[{"cmd":"npm install vite-build-monitor","lang":"bash","label":"npm"},{"cmd":"yarn add vite-build-monitor","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-build-monitor","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; default export. TypeScript types included.","wrong":"const memoryMonitor = require('vite-build-monitor')","symbol":"default (memoryMonitor)","correct":"import memoryMonitor from 'vite-build-monitor'"},{"note":"Type import only; the interface is not a runtime value.","wrong":"import { MemoryMonitorOptions } from 'vite-build-monitor'","symbol":"MemoryMonitorOptions","correct":"import type { MemoryMonitorOptions } from 'vite-build-monitor'"},{"note":"This is a type union, not a value; requires type import.","wrong":"const { HookName } = require('vite-build-monitor')","symbol":"HookName","correct":"import type { HookName } from 'vite-build-monitor'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport memoryMonitor from 'vite-build-monitor';\n\nexport default defineConfig({\n  plugins: [\n    memoryMonitor({\n      logFile: './build-memory.log',\n      sampleIntervalMs: 100,\n      logFormat: 'pretty',\n      summaryTopN: 3,\n      excludeHooks: ['buildEnd', 'renderStart'],\n      printSummary: true,\n    }),\n  ],\n});","lang":"typescript","description":"Configure vite-build-monitor as a Vite plugin with custom options: log file path, polling interval, log format, and hook exclusions."},"warnings":[{"fix":"Upgrade Node.js to v22 or later.","message":"This package requires Node.js >=22.0.0. Older Node versions will fail to install or import.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Explicitly set sampleIntervalMs to at least 50 if you need fine-grained polling.","message":"The sampleIntervalMs option is clamped to minimum 50ms. Setting a value <50 will be silently uplifted to 50.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always use an absolute path or ensure cwd is the project root when specifying logFile.","message":"The logFile path is resolved relative to process.cwd(), not the project root. This can lead to unexpected file locations.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pin to a specific version and review changelog before upgrading.","message":"No deprecated features currently. This is a young package (v1.0.5). Future versions may change defaults or remove options.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import statement: import memoryMonitor from 'vite-build-monitor';","cause":"The package is ESM-only, and you are using require() instead of import.","error":"ERR_REQUIRE_ESM: require() of ES Module 'vite-build-monitor' from ... not supported."},{"fix":"Call the function: plugins: [memoryMonitor({ ... })]","cause":"Importing the plugin without calling it as a function (e.g., passing memoryMonitor directly instead of memoryMonitor()).","error":"TypeError: Cannot read properties of undefined (reading 'sampleIntervalMs')"},{"fix":"Ensure the package is installed: pnpm add -D vite-build-monitor","cause":"Package not installed, or installed as devDependency but runtime resolution fails.","error":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'vite-build-monitor'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}