Registry / devops / treeshake-cli

treeshake-cli

JSON →
library0.2.6jsnpmunverified

treeshake-cli is a command-line tool that analyzes JavaScript bundles to determine how effectively Rollup, Webpack, and ESBuild tree-shake unused code. Version 0.2.6 is stable with monthly releases. It provides a unified interface to run multiple bundlers on the same input and compare outputs, highlighting dead code elimination differences. Unlike manual bundler configuration, it offers an out-of-the-box comparison with clear metrics.

npm install treeshake-cli
INSTALL
IMPORT
SIG · TREESHAKE-CLI
T
treeshake-cli
devopsjavascriptv0.2.6
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.

treeshake-cli
✓ npx treeshake-cli@latest <file>
CLI tool, not imported in code; run via npx or global install.

Analyzes bundle.js for tree-shaking efficiency using Rollup, Webpack, and ESBuild.

npx treeshake-cli@latest bundle.js # or install globally: npm install -g treeshake-cli treeshake-cli bundle.js
Debug
Known issues
gotchaThe tool requires Node.js 12+ and may not work with older versions.
fix
Update Node.js to 12+ or use npx which manages version automatically.
affects: <0.2.0
gotchaOnly JavaScript/ES module inputs supported; CommonJS inputs are not analyzed.
fix
Convert CommonJS to ESM or use a different tool for CJS analysis.
affects: all
gotchaThe file must be a valid ES module bundle; non-bundle files may produce misleading results.
fix
Ensure input is a bundled output (not raw source code).
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'rollup'
Rollup is not installed or not found in node_modules.
fix
Install rollup: npm install rollup -D
Error: Expected a JavaScript file
The input file is not recognized as JavaScript (e.g., .ts or .json).
fix
Provide a .js or .mjs file that is an ES module bundle.
Error: Bundle must be an ES module
The input bundle uses CommonJS syntax (require, module.exports).
fix
Ensure the input bundle is an ES module (use import/export) or transpile to ESM.
Upgrade
Version history
0.2.6latest on npm
Audit
Dependencies
rollupoptionalBundler used for tree-shaking analysis
webpackoptionalBundler used for tree-shaking analysis
esbuildoptionalBundler used for tree-shaking analysis
Agent activity
10 hits · last 30 days
node
8
Amazon
1
Resources