JSPM

webpack-dependency-size

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 24
  • Score
    100M100P100Q59056F
  • License MIT

Webpack plugin to get an overview of bundled dependencies and their size

Package Exports

  • webpack-dependency-size

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (webpack-dependency-size) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

👩‍🔬 Webpack Dependency Size Plugin

Webpack plugin to get an overview of bundled dependencies and their size.

🙋 Why?

  • 📦 Only Dependencies Get insight into the blackbox!
  • 🔥 Fast Only analyzes the bare minium!
  • 👀 JSON Output Formatted, sorted, and portable!
  • 🙈 No distractions Ignore application code!

🚀 Install

npm i webpack-dependency-size

Basic Usage

In your Webpack config:

// 1. Import plugin
const DependencySize = require('webpack-dependency-size');

module.exports = {
    ...,

    plugins: [
        // 2. Add to plugins array
        new DependencySize({
            // Options
        })
    ]
};

Options

  • outputPath (dependency-size.json) JSON output path relative to Webpack output directory (output.path)
  • gzip (false) Calculate gzipped size
  • indent (2 spaces) JSON output indentation

Output

Schema

  • [package path] bundled-in package (sorted by size)
    • size human-readable net import size from package
    • files specific files imported from the package (sorted by size)
      • filepath bundled-in file
      • size human-readable size
      • reasons request sources

Example

Tip: If the output is too large, I recommend using fx to navigate the JSON

{
  "./node_modules/axios": {
    "size": "40.15 KB",
    "files": [
      {
        "filepath": "./node_modules/axios/lib/utils.js",
        "size": "8.61 KB",
        "reasons": [
          "./node_modules/axios/lib/adapters/xhr.js",
          ...
        ]
      },
      ...
    ]
  },
  "./node_modules/lodash": {
    "size": "25.37 KB",
    "files": [
      {
        "filepath": "./node_modules/lodash/_deburrLetter.js",
        "size": "3.33 KB",
        "reasons": [
          "./node_modules/lodash/deburr.js"
        ]
      },
      ...
    ]
  },
  ...
}

License

MIT