{"id":42309,"library":"weigh","title":"weigh","description":"A CLI tool to estimate the bundle size of browser-compatible npm modules by downloading, bundling with browserify or concat, minifying with uglify/closure/babili/butternut, and optionally gzipping. Current stable version is 5.1.0. It supports various module identifiers (scoped packages, submodules, versions) and outputs uncompressed, minified, and gzipped sizes. Key differentiator: simple one-command bundle size estimation without setup. Release cadence is low (last major release 2017). Note: Only works with CommonJS modules, not ESM.","status":"maintenance","version":"5.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/bjoerge/weigh","tags":["javascript"],"install":[{"cmd":"npm install weigh","lang":"bash","label":"npm"},{"cmd":"yarn add weigh","lang":"bash","label":"yarn"},{"cmd":"pnpm add weigh","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Default bundler used to create the bundle","package":"browserify","optional":true}],"imports":[{"note":"weigh is a CLI tool, not a library. Must be installed globally or run via npx.","wrong":"npx weigh lodash (requires global install)","symbol":"weigh (CLI)","correct":"npm i -g weigh && weigh lodash"}],"quickstart":{"code":"npm i -g weigh\nweigh lodash\n# Output approximate sizes:\n# Uncompressed: ~412.11 kB\n# Minified (uglify): 51.61 kB\n# Minified and gzipped: ~18.82 kB\n\n# Check size of a specific submodule:\nweigh lodash/map\n\n# Use different bundler and minifier:\nweigh --bundler concat --minifier closure lodash\n\n# Output bundle for further inspection (pipe to discify):\nweigh --output rxjs --no-gzip | discify --open","lang":"javascript","description":"Shows typical usage: install globally, get sizes for a package, submodule, and custom bundling."},"warnings":[{"fix":"Use the default minifier (uglify) or switch to 'closure' or 'babili'.","message":"The `uglify` minifier is deprecated; use `terser` instead but not supported.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Use --development flag to compare sizes.","message":"NODE_ENV defaults to 'production' which may strip development code; results may differ from dev builds.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure the package is compatible with CommonJS or use esm bundler workaround.","message":"Only CommonJS modules are supported; ES modules (ESM) may fail or give incorrect sizes.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Install globally with npm i -g weigh.","message":"Global install is required; npx weigh may not work as expected due to missing global transforms.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2017':68 '5.1.0':33 'browser':12 'browser-compat':11 'browserifi':20 'bundl':8,18,56 'cadenc':62 'cli':3 'command':55 'commonj':73 'compat':13 'concat':22 'current':29 'differenti':51 'download':17 'esm':76 'estim':6,58 'gzip':28,48 'identifi':38 'javascript':77 'key':50 'last':65 'low':64 'major':66 'minifi':23,46 'modul':15,37,74 'note':69 'npm':14 'one':54 'one-command':53 'option':27 'output':44 'packag':40 'releas':61,67 'scope':39 'setup':60 'simpl':52 'size':9,49,57 'stabl':30 'submodul':41 'support':35 'tool':4 'uglify/closure/babili/butternut':25 'uncompress':45 'various':36 'version':31,42 'weigh':1 'without':59 'work':71","created_at":"2026-06-04T18:56:38.164419+00:00","updated_at":"2026-06-04T18:56:38.164419+00:00","problems":[{"fix":"Reinstall globally: npm i -g weigh","cause":"UglifyJS is not bundled; requires global install or explicit dependency.","error":"Error: Cannot find module 'uglify-js'"},{"fix":"Install globally: npm i -g weigh","cause":"weigh is not installed or not in PATH.","error":"bash: weigh: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/bjoerge/weigh#readme","github":"https://github.com/bjoerge/weigh","docs":null,"changelog":null,"pypi":null,"npm":"weigh","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}