{"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,"search_vec":"'22.0.0':66 'build':3,18,31,87,97 'buildstart':89 'captur':62 'compar':71 'configur':25 'consum':42 'declar':70 'diagnost':102 'etc':91 'except':61 'exclus':52 'format':51 'generic':73 'heap':11,100 'hook':55,88 'integr':83 'interv':26 'javascript':92 'json':49 'level':81 'log':50,57 'memori':14,22,41,98 'memory-consum':40 'monitor':4,10,75,99 'node':65 'option':59 'output':34 'peak':28 'per':30 'phase':32,43,80 'phase-level':79 'plugin':7,45,77,96 'pretti':47 'process':19,74 'provid':78 'record':21 'renderchunk':90 'requir':64 'rss':13,101 'ship':68 'snapshot':23 'specif':54 'summari':36 'support':46 'top':39 'track':27,82 'typescript':69,103 'uncaught':60 'usag':15,29 'v1.0.5':8 'vite':2,6,85,93,95 'vite-build-monitor':1 'vite-plugin':94","created_at":"2026-04-25T07:40:44.695850+00:00","updated_at":"2026-04-25T07:40:44.695850+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/BINGWU2003/vite-build-monitor","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-build-monitor","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}