Registry / web-framework / esbuild-lazy-analyzer

esbuild-lazy-analyzer

JSON →
library1.4.0jsnpmunverified

A CLI tool (v1.4.0, active development) that analyzes lazy-loading in esbuild chunk splits using the metafile output. It generates static JSON statistics and interactive HTML dependency graphs showing chunk composition, eager vs lazy imports per entry point, length of dependency chains, and file-level bundle impact. Unlike general esbuild visualizers (e.g., esbuild-visualizer), this focuses on code-splitting optimization, showing which chunks are lazy-loaded and their sizes, enabling developers to identify opportunities for improved lazy-loading. It produces a self-contained HTML report with interactive import graphs and modals for per-file import inspection.

npm install esbuild-lazy-analyzer
INSTALL
IMPORT
SIG · ESBUILD-LAZY-ANALY
E
esbuild-lazy-analyzer
web-frameworkjavascriptv1.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

esbuild-lazy-analyzer
✓ npx esbuild-lazy-analyzer --metafile meta.json --outreport report.html
✗ npm run esbuild-lazy-analyzer
Tool is a CLI, not a library. Use npx or install globally and run directly. No JavaScript API is exported.

Generate an esbuild metafile and run the analyzer to produce an interactive HTML report.

// Build with esbuild and output metafile npx esbuild src/index.js --bundle --splitting --format=esm --outdir=dist --metafile=meta.json // Analyze lazy-loading npx esbuild-lazy-analyzer --metafile meta.json --outreport report.html // Open report.html in browser
esbuild-lazy-analyzer --version
Debug
Known issues
gotchaThe --metafile must be produced with esbuild's splitting enabled; otherwise, there is only one chunk and analysis is trivial.
fix
Ensure esbuild run with --splitting flag: npx esbuild ... --splitting
affects: >=1.0.0
gotchaAt least one of --outmeta or --outreport is required; the tool will error if neither is provided.
fix
Add --outmeta path.json or --outreport path.html (or both).
affects: >=1.0.0
gotchaThe tool generates HTML with relative imports for D3; the report must be served via HTTP (not file://) to display graphs correctly.
fix
Use a local server (e.g., npx serve .) to open the report.
affects: >=1.0.0
Errors
Common errors & fixes
Error: The specified metafile does not exist.
The --metafile path is incorrect or the file wasn't generated.
fix
Verify the path and re-run esbuild with --metafile to create the metafile.
Error: No data found in the metafile's outputs.
The metafile is valid but doesn't contain output chunks (e.g., splitting not enabled).
fix
Run esbuild with --splitting and --format=esm to generate multiple chunks.
Upgrade
Version history
1.4.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-lazy-analyzer — npm install esbuild-lazy-analyzer · libregistry