{"id":13394508,"url":"https://github.com/bjoerge/weigh","last_synced_at":"2025-04-13T14:10:43.223Z","repository":{"id":65520268,"uuid":"42748407","full_name":"bjoerge/weigh","owner":"bjoerge","description":"A command line tool to check the bundle size of one or more browser compatible npm modules","archived":false,"fork":false,"pushed_at":"2018-01-11T18:43:31.000Z","size":155,"stargazers_count":59,"open_issues_count":4,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T14:40:57.789Z","etag":null,"topics":["bundlesize","weight"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bjoerge.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-18T21:42:32.000Z","updated_at":"2021-04-18T19:42:12.000Z","dependencies_parsed_at":"2023-01-27T02:45:19.616Z","dependency_job_id":null,"html_url":"https://github.com/bjoerge/weigh","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjoerge%2Fweigh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjoerge%2Fweigh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjoerge%2Fweigh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjoerge%2Fweigh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjoerge","download_url":"https://codeload.github.com/bjoerge/weigh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724629,"owners_count":21151561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundlesize","weight"],"created_at":"2024-07-30T17:01:22.029Z","updated_at":"2025-04-13T14:10:43.197Z","avatar_url":"https://github.com/bjoerge.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Weigh [![Build Status](https://travis-ci.org/bjoerge/weigh.svg)](https://travis-ci.org/bjoerge/weigh)\n\nA command line tool to check the bundle size of one or more browser compatible npm modules\n\n## Install\n\n```\nnpm i -g weigh\n```\n\n## Usage\n\n```\nUsage: weigh [\u003cargs\u003e] \u003cmodule1\u003e [\u003cmodule2\u003e] [\u003cmoduleN\u003e...]\n\nSupports any module identifier on the format [@scope/]package[@version][/module.js]\n\n  Options:\n    --help, -h          Show this usage information\n\n    --bundler -b        Which bundler to use. Can be one of\n                          • `browserify` (default)\n                          • `concat`\n\n    --minifier, -m      Specify which JavaScript minifier to use. Can be either\n                          • `uglify` for UglifyJS (default)\n                          • `closure` for Closure Compiler\n                          • `babili` for Babili\n                          • `butternut` for Butternut\n\n    --verbose, -v       Do a little more logging along the way\n\n    --gzip-level, -g    Gzip compression level\n\n    --no-minify         Don't minify\n\n    --no-gzip           Don't gzip\n\n    --uncompressed, -u  Shorthand for --no-minify --no-gzip\n\n    --env               The value of process.env.NODE_ENV inside the bundle.\n                        Defaults to `production`\n\n    --output -o         Output final result to stdout. You may also want to\n                        disable gzipping with --no-gzip\n                        If browserify used for bundling, `fullpaths: true`\n                        will be passed as an option to browserify, so that\n                        e.g. `discify` can be used for further bundle\n                        inspection\n\n    --version           Output current version\n\n    Examples:\n      weigh lodash\n      weigh lodash/map\n      weigh lodash@latest/map\n      weigh @myorg/mypkg\n      weigh @myorg/mypkg@latest\n      weigh @myorg/mypkg/foo/bar.js\n      weigh @myorg/mypkg@latest/foo/bar.js\n      weigh @myorg/mypkg@2.1.4/foo/bar.js\n      weigh ./path/to/foo/bar.js\n      weigh /absolute/path/to/foo/bar.js\n      weigh . (resolved module from cwd)\n```\n\n## Example:\n```\n$ weigh lodash\n```\nOutputs:\n```\nDownloading lodash, this may take a little while…\nDownloaded 1 package(s)\n\nWeighing lodash…\n\nApproximate weight of lodash:\n  Uncompressed: ~412.11 kB\n  Minified (uglify): 51.61 kB\n  Minified and gzipped (level: default): ~18.82 kB\n```\n\nNote: By default `weigh` uses browserify under the hood to bundle the module, and adds envify as a global transform, with `NODE_ENV` set to `production`\n\nThis means weigh will report the size of a production build for modules that does code branching based on `process.env.NODE_ENV`\n\nFor example compare:\n\n```\n$ weigh redux\nApproximate weight of redux:\n  Uncompressed: 28.5 kB\n  Minified (uglify): 7.82 kB\n  Minified and gzipped (level: default): 2.73 kB\n```\n\n...with:\n\n```\n$ weigh redux --development\nApproximate weight of redux:\n  Uncompressed: 28.5 kB\n  Minified (uglify): 9.23 kB\n  Minified and gzipped (level: default): 3.36 kB\n```\n\n## Inspecting the final result\nYou can output the compiled bundle for further inspection using `--output` (or `-o`) command line option. Note: By default this will output the gzipped result, so you'd probably want to use the `--no-gzip` flag \n\nThis will just pipe generated the bundle to stdout, which also enables further bundle size breakdown e.g. using [hughsk/disc](https://github.com/hughsk/disc).\n\nFor example:\n\n```\nweigh --output rxjs --no-gzip | discify --open\n```\n\n### Some more examples of supported module formats\n\n- `weigh lodash`\n- `weigh lodash/collection/map`\n- `weigh lodash@latest/collection/map`\n- `weigh @myorg/mypkg`\n- `weigh @myorg/mypkg@latest`\n- `weigh @myorg/mypkg/foo/bar.js`\n- `weigh @myorg/mypkg@latest/foo/bar.js`\n- `weigh @myorg/mypkg@2.1.4/foo/bar.js`\n- `weigh ./path/to/foo/bar.js`\n- `weigh /absolute/path/to/foo/bar.js`\n- `weigh .` (module in cwd)\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjoerge%2Fweigh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjoerge%2Fweigh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjoerge%2Fweigh/lists"}