whybundled
Answers the question – Why the hell is this module in a bundle?
Last updated 2 years ago by sysoev .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install whybundled 
SYNC missed versions from official npm registry.


whybundled




NPM Version License Github Issues Travis Status Coverage Status Commitizen Friendly



Ever wondered why any particular module ended up in a bundle? WhyBundled is here to answer exactly this question.

It's meant to be used alongside stats report from webpack.

Quick Start

npm i -g whybundled

whybundled stats.json ← stats file generated by wepback

whybundled default report

Usage

Usage
  $ whybundled stats.json "[pattern]"                   [default command]
  $ whybundled stats.json --ignore babel-runtime,tslib  [default command]
  $ whybundled stats.json --by styled-components        [by command]

Default options:
  [pattern]          Optional pattern used to filter output to only matched modules
                     Note: you might need to wrap the pattern in quotes to use wildcards, e.g. "*.jsx"
  --ignore           Comma separated list of glob pattern to exclude modules from final output
  --modulesOnly      Only include modules
  --filesOnly        Only include files
  --directOnly       Only include direct dependencies
  --transitiveOnly   Only include transitive dependencies
  --duplicatesOnly   Only include modules that have duplicates in a resulting bundle
  --limit            Limits output of reasons and files [default: 20]

By options [--by]:
  --ignore           Comma separated list of glob pattern to exclude modules from final output
  --limit            Limits output of reasons and files [default: 20]
  --only             Limits output to only include modules that were included by specified module exclusively

Other options:
  -v, --version      Shows version.
  --help             Shows help.

Examples
  $ whybundled stats.json --modulesOnly

Features

Stats Analyses

  • Outputs list of all modules/files included in the bundle in from most imported to least imported order.
  • Builds a chain of dependencies for transitive dependencies.
  • Shows all files that were included for particular module.
  • Shows all reasons why particular module was included.
MODULE  isobject
├─ imported: 1 time     ← number of times module imported
├─ type: [transitive]   ← type of a dependency can be either direct or transitive
│  └─ isobject -> is-plain-object -> styled-components    ← for transitive dependencies whybundled outputs a chain of dependencies up to the closest direct
│
├─ locations:  ← where module is located in a project
│  └─ ../node_modules/isobject/
│
├─ files:      ← list of files that were included for this module
│  └─ ../node_modules/isobject/index.js
│
└─ reasons:    ← list of reasons why module was included in a bundle
   └─ is-plain-object
      └─ ../node_modules/is-plain-object/index.js  10:15-34  [cjs require]

Duplicates Badge

If module has been bundled several times from different locations whybundled adds [multiple] badge next to the locations field:

whybundled duplicates

Brought by

Using --by flag whybundled shows all modules that were brought into the bundle by a particular module:

whybundled stats.json --by styled-components

whybundled brought by

Current Tags

  • 1.4.3                                ...           latest (5 months ago)

10 Versions

  • 1.4.3                                ...           5 months ago
  • 1.4.2                                ...           2 years ago
  • 1.4.1                                ...           2 years ago
  • 1.4.0                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 3
Dependencies (4)
Dev Dependencies (11)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |