Inspect npm package size estimates from Bundlephobia without leaving the editor. Package names and requested versions are sent to Bundlephobia when checked.
Commands
Open the Command Palette and run:
Bundlephobia: Scan package.json — scan the open package.json, or choose one from the workspace. Choose dependencies, devDependencies, or both. The results are sorted by gzip size; select a package for details or to open Bundlephobia.
Bundlephobia: Scan workspace — scan package files in the workspace, excluding node_modules.
Bundlephobia: Get package info by name — check one name, optionally with a version (for example, lodash@4.17.21 or @scope/package).
Bundlephobia: Clear cache and scan package.json — discard cached results and request fresh estimates.
A scan shows progress and can be cancelled. Unavailable packages appear in the results with an explanation and a retry action. Local, workspace, Git and npm alias dependencies cannot be checked as registry packages.
After a scan, CodeLens shows the minified and gzipped sizes beside checked dependencies in package.json. Click a size for details. The requested version range and the version resolved by Bundlephobia may differ. The sum shown in results adds individual package estimates: it is not the application bundle size, which depends on imports, shared dependencies, tree shaking and build configuration.
Settings
bundlephobia.autoCheck (default: false) automatically checks dependencies in open package.json files. This sends their names and versions to Bundlephobia.
bundlephobia.dependencySections (default: ["dependencies"]) selects the sections used for automatic checks and the configured scan. Choose dependencies, devDependencies, or both.
Successful requests are cached for the current VS Code session. Use the clear-cache command to refresh them.