webpack-bundle-size-analyzer
Advanced tools
Comparing version 2.5.0 to 2.6.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var commander = require("commander"); | ||
@@ -3,0 +4,0 @@ var fs = require("fs"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var filesize = require("filesize"); | ||
@@ -3,0 +4,0 @@ var path = require("path"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function isMultiCompilation(stats) { | ||
@@ -3,0 +4,0 @@ return !stats.hasOwnProperty('modules'); |
@@ -0,1 +1,5 @@ | ||
## 2.6.0 | ||
- Enable the tool to be used as a Webpack plugin. | ||
## 2.5.0 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "webpack-bundle-size-analyzer", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "A utility to find how your dependencies are contributing to the size of your Webpack bundles", | ||
"main": "build/size_tree.js", | ||
"main": "build/src/index.js", | ||
"scripts": { | ||
"postversion": "git push && git push --tags && npm publish", | ||
"preversion": "npm test", | ||
"coverage": "jest --coverage --no-cache", | ||
"test": "make test", | ||
@@ -35,10 +36,26 @@ "version": "make clean && make" | ||
"devDependencies": { | ||
"@types/chai": "^3.4.34", | ||
"@types/commander": "^2.3.31", | ||
"@types/mocha": "^2.2.36", | ||
"@types/jest": "^19.2.2", | ||
"@types/node": "^6.0.58", | ||
"chai": "^3.5.0", | ||
"mocha": "^3.2.0", | ||
"jest": "^19.0.2", | ||
"ts-jest": "^19.0.5", | ||
"typescript": "^2.1.4" | ||
}, | ||
"jest": { | ||
"coverageReporters": [ | ||
"text-summary", | ||
"html", | ||
"lcovonly" | ||
], | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js" | ||
], | ||
"transform": { | ||
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
}, | ||
"testResultsProcessor": "<rootDir>/node_modules/ts-jest/coverageprocessor.js", | ||
"testRegex": "/tests/.*\\.(ts|tsx|js)$" | ||
} | ||
} |
@@ -21,6 +21,12 @@ Webpack Bundle Size Analyzer | ||
```` | ||
There are 2 ways to use this tool: | ||
1. As a command line application | ||
2. As a webpack plugin | ||
### CLI Usage | ||
``` | ||
npm install -g webpack-bundle-size-analyzer | ||
webpack --json | webpack-bundle-size-analyzer | ||
```` | ||
``` | ||
@@ -57,2 +63,54 @@ When run on [react-testing](https://github.com/robertknight/react-testing) for example, | ||
### Plugin Usage | ||
#### Description | ||
When using the plugin version of this library, a file will be written to a | ||
location of your choice (when you run your webpack build). The file contents | ||
will be a list of the packages in your bundle (sorted in descending order). | ||
Each line will contain the name of a package, along with it's file size, and the | ||
percentage of space it takes up in your bundle. | ||
#### Plugin Installation | ||
Install this library as a development dependency to your webpack project: | ||
``` | ||
npm install --save-dev webpack-bundle-size-analyzer | ||
``` | ||
Import your plugin at the top of your `webpack.config.js` file: | ||
Old School: | ||
``` | ||
var WebpackBundleSizeAnalyzerPlugin = require('webpack-bundle-size-analyzer').WebpackBundleSizeAnalyzerPlugin; | ||
``` | ||
New School: | ||
``` | ||
import { WebpackBundleSizeAnalyzerPlugin } from 'webpack-bundle-size-analyzer'; | ||
``` | ||
Now in your webpack's plugin section, start using this plugin: | ||
``` | ||
{ | ||
{...topOfConfig} | ||
plugins: [ | ||
new WebpackBundleSizeAnalyzerPlugin('./reports/plain-report.txt') | ||
] | ||
{...bottomOfConfig} | ||
} | ||
``` | ||
#### Example Plugin Output | ||
Using the above plugin configuration, the following file will be written: | ||
`<webpack-output-path>/reports/plain-report.txt`: | ||
```text | ||
marked: 27.53 KB (14.9%) | ||
lru-cache: 6.29 KB (3.40%) | ||
style-loader: 717 B (0.379%) | ||
<self>: 150.33 KB (81.3%) | ||
``` | ||
### Important Note About Minified Code | ||
@@ -59,0 +117,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16264
6
9
241
123
2