Registry / devops / heap-sampling-webpack-plugin

heap-sampling-webpack-plugin

JSON →
library1.2.2jsnpmunverified

A Webpack plugin that adds heap sampling profiling to builds using Node.js Inspector HeapProfiler. It generates .heapprofile files openable in Chromium DevTools Memory tab. Version 1.2.2 is stable with no recent updates. Unlike CPU profiling (e.g., webpack.debug.ProfilingPlugin), this focuses on memory allocation, suitable for production builds to diagnose memory consumption in build machines. Configuration is minimal via Webpack plugin array.

npm install heap-sampling-webpack-plugin
INSTALL
IMPORT
SIG · HEAP-SAMPLING-WEBP
H
heap-sampling-webpack-plugin
devopsjavascriptv1.2.2
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HeapSamplingPlugin
const HeapSamplingPlugin = require('heap-sampling-webpack-plugin');
import HeapSamplingPlugin from 'heap-sampling-webpack-plugin';
Plugin is CommonJS only; no ES module wrapper provided.
new HeapSamplingPlugin()
new HeapSamplingPlugin({ outputPath: '/path/to/file.heapprofile' })
new HeapSamplingPlugin('/path/to/file.heapprofile')
Options are passed as an object, not a string. The only option is outputPath.
HeapSamplingPlugin as type (TypeScript)
declare module 'heap-sampling-webpack-plugin' { const HeapSamplingPlugin: any; export = HeapSamplingPlugin; }
import { HeapSamplingPlugin } from 'heap-sampling-webpack-plugin';
No TypeScript types included; use any or declare module manually.

Shows basic Webpack configuration with HeapSamplingPlugin enabling heap profiling output to a file.

const HeapSamplingPlugin = require('heap-sampling-webpack-plugin'); module.exports = { plugins: [ new HeapSamplingPlugin({ outputPath: '/tmp/build.heapprofile' }) ] };
Debug
Known issues
gotchaPlugin uses Node.js Inspector protocol, which may not be available in all environments (e.g., restricted Docker containers).
fix
Ensure Node.js process has inspector access (--inspect flag not required, but runtime must support Inspector).
affects: all
gotchaOutput file is overwritten on each build without warning.
fix
Use a unique filename per build (e.g., include timestamp in outputPath).
affects: all
deprecatedThe plugin has not been updated in several years; may not work with Webpack 5+ due to internal API changes.
fix
Test with your Webpack version; consider alternatives like webpack-bundle-analyzer for memory analysis.
affects: >=1.2.2
gotchaHeap sampling increases build time and memory usage significantly.
fix
Use only for diagnostic builds, not in CI pipeline for every commit.
affects: all
Errors
Common errors & fixes
Error: Inspector is not available
Node.js runtime does not support Inspector (e.g., in some bundled environments).
fix
Ensure you are using a standard Node.js runtime (not a stripped-down build) and that the process has inspector permissions.
TypeError: HeapSamplingPlugin is not a constructor
Incorrect import style (used ES module import on CommonJS module).
fix
Use require('heap-sampling-webpack-plugin') instead of import.
heapprofile file empty or not generated
Plugin runs after compilation but may not have permission to write to outputPath.
fix
Ensure outputPath directory exists and is writable. Use absolute path or ensure relative path is correct for Webpack context.
Upgrade
Version history
1.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Bingbot
1
Resources
heap-sampling-webpack-plugin — npm install heap-sampling-webpack-plugin · libregistry