whyinstall
v0.3.2
Published
CLI tool to find why a dependency exists in your JS/TS project
Maintainers
Readme
whyinstall
CLI tool to find why a dependency exists in your JS/TS project. Works with npm, yarn, and pnpm.
Installation
npm install -g whyinstallOr use with npx:
npx whyinstall <package-name>Usage
whyinstall lodashOptions
-j, --json- Output results as JSON-c, --cwd <path>- Set working directory (default: current directory)-s, --size-map- Show bundle size impact breakdown
Features
- Works with npm, Yarn, and pnpm (auto-detection)
- Shows dependency chains for any package
- Displays dependency type (prod, dev, peer, optional)
- Shows package description, version, and size
- Finds source files that actually use the package
- Colored tree output for readability
- JSON output for CI/CD
- Actionable suggestions for optimization
- Bundle size impact breakdown
Example Output
whyinstall chalkchalk v5.3.0 (43 KB)
Terminal string styling done right
installed via 1 path
1. prod
whyinstall
└─> chalk
Used in (2):
src/cli.ts
src/formatter.ts
Suggested actions:
1. Can be removed from direct dependencies - it's installed transitivelySize Map Output
whyinstall next --size-mapSize map for: next
next total impact: 66.69 MB
Breakdown:
- next: 63.08 MB
- caniuse-lite: 2.19 MB
- styled-jsx: 971 KB
- @swc/helpers: 190 KB
- source-map-js: 104 KB
- postcss: 101 KB
- tslib: 60 KB
- nanoid: 20 KB
- @next/env: 10 KB
- picocolors: 3 KB
- client-only: 144 B
This package contributes 44.7% of your vendor bundle.Development
npm install
npm run build
npm linkLicense
MIT
