{"id":26938,"library":"esbuild-bundle-analyzer","title":"esbuild Bundle Analyzer","description":"A tool to analyze the size and composition of esbuild output bundles, helping identify optimization opportunities. Version 0.0.1 is extremely early and unstable — expect breaking changes with every release. Unlike bundle analyzers for Webpack (webpack-bundle-analyzer) or Rollup (rollup-plugin-visualizer), this is native to esbuild's plugin system, but currently lacks interactive visualizations and detailed module trees. Release cadence is not established.","status":"active","version":"0.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install esbuild-bundle-analyzer","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-bundle-analyzer","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-bundle-analyzer","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only. No CJS support.","wrong":"const bundleAnalyzer = require('esbuild-bundle-analyzer')","symbol":"bundleAnalyzer","correct":"import { bundleAnalyzer } from 'esbuild-bundle-analyzer'"},{"note":"Default export aliases the named export. Avoid as it may be removed.","wrong":"","symbol":"default","correct":"import bundleAnalyzer from 'esbuild-bundle-analyzer'"},{"note":"Internal class name, not public API. Unlikely to work.","wrong":"","symbol":"BundleAnalyzerPlugin","correct":"import { BundleAnalyzerPlugin } from 'esbuild-bundle-analyzer'"},{"note":"Utility type for plugin options.","wrong":"","symbol":"type Options","correct":"import type { Options } from 'esbuild-bundle-analyzer'"}],"quickstart":{"code":"import * as esbuild from 'esbuild';\nimport { bundleAnalyzer } from 'esbuild-bundle-analyzer';\n\nawait esbuild.build({\n  entryPoints: ['app.js'],\n  bundle: true,\n  outfile: 'out.js',\n  plugins: [bundleAnalyzer({\n    outfile: 'report.json',\n    verbose: false\n  })],\n});\nconsole.log('Bundle analysis written to report.json');","lang":"typescript","description":"Shows how to add the bundle analyzer as an esbuild plugin to generate a report JSON file during build."},"warnings":[{"fix":"Pin esbuild version to exact match; await stable releases.","message":"API is unstable: plugin may not work with esbuild versions outside 0.0.1 range.","severity":"breaking","affected_versions":">=0.0.1 <0.1.0"},{"fix":"Use named export { bundleAnalyzer } instead.","message":"Default export may be removed in future releases.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Restart build every time for accurate results.","message":"Plugin does not support esbuild's watch mode properly; analysis may not update on rebuild.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Analyze subsets of the bundle or increase Node memory limit (--max-old-space-size).","message":"Large bundles (>10MB) may cause out-of-memory errors.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use separate tools for non-JS assets.","message":"Only analyzes JavaScript/TypeScript files; CSS, images, and other assets are ignored.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install esbuild-bundle-analyzer@0.0.1' and verify import statement.","cause":"Package not installed or import path incorrect.","error":"Error: Cannot find module 'esbuild-bundle-analyzer'"},{"fix":"Use 'import { bundleAnalyzer } from \"esbuild-bundle-analyzer\"' in an ESM context.","cause":"Importing as CJS require instead of ESM import.","error":"TypeError: bundleAnalyzer is not a function"},{"fix":"Use 'plugins: [bundleAnalyzer()]' (call the function) instead of 'plugins: [bundleAnalyzer]'.","cause":"Incorrect plugin instantiation: passing function directly without calling it.","error":"Error: The plugin must be a function or object with 'name' property."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}