Show the install size, dependency count, and tree depth of every package in your node_modules.
Find the heaviest dependencies in seconds. Zero dependencies. Works with any Node.js project.
Your node_modules is 500 MB but you have no idea which package is responsible.
dep-size answers:
- How large is each dependency on disk?
- How many transitive dependencies does each one pull in?
- How deep is each dependency tree?
npx dep-sizeOr install globally:
npm install -g dep-size# Show all dependencies sorted by size (largest first)
dep-size
# Show only top 10 heaviest packages
dep-size --top=10
# Include devDependencies
dep-size --dev
# Sort by transitive dependency count
dep-size --sort=deps
# Sort alphabetically
dep-size --sort=name
# JSON output for scripting
dep-size --json
# Analyze a specific project
dep-size ./my-project------------------------------------------------------------------------
Package Version Size Deps Depth
------------------------------------------------------------------------
typescript 5.8.3 73.2 MB 0 0
@next/swc-win32-x64-msvc 16.1.7 48.1 MB 0 0
esbuild 0.25.1 10.4 MB 1 1
rollup 4.37.0 8.9 MB 1 1
prettier 3.5.3 7.8 MB 0 0
eslint 9.22.0 3.2 MB 42 5
------------------------------------------------------------------------
Total: 6 packages, 151.6 MB
| Flag | Description | Default |
|---|---|---|
--json |
Output as JSON | table |
--sort=size |
Sort by disk size | size |
--sort=name |
Sort alphabetically | - |
--sort=deps |
Sort by transitive deps | - |
--top=N |
Show only top N packages | all |
--dev |
Include devDependencies | false |
--help |
Show help | - |
dep-size --json --top=3[
{
"name": "typescript",
"version": "5.8.3",
"sizeBytes": 76742656,
"transitiveDeps": 0,
"depth": 0,
"sizeHuman": "73.2 MB"
}
]- CI pipeline: Fail builds when total dependency size exceeds a threshold
- PR review: Check if a new dependency adds unexpected bloat
- Cleanup: Find packages pulling in hundreds of transitive dependencies
- Docker: Reduce container image size by identifying heavy dependencies
- Node.js 18+
- An existing
node_modulesdirectory (runnpm installfirst)
MIT