Socket
Socket
Sign inDemoInstall

webpack-bundle-size-analyzer

Package Overview
Dependencies
3
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

2

build/size_tree.js

@@ -6,3 +6,3 @@ /// <reference path="typings/typings.d.ts" />

// '(<loader expression>!)?/path/to/module.js'
var loaderRegex = /.*![^!]+/;
var loaderRegex = /.*!/;
return identifier.replace(loaderRegex, '');

@@ -9,0 +9,0 @@ }

@@ -15,1 +15,29 @@ /// <reference path="../typings/typings.d.ts" />

});
describe('dependencySizeTree()', function () {
it('should produce correct results where loaders are used', function () {
var webpackOutput = {
version: '1.2.3',
hash: 'unused',
time: 100,
assetsByChunkName: {},
assets: [],
chunks: [],
modules: [{
id: 0,
identifier: '/path/to/loader.js!/path/to/project/node_modules/dep/foo.js',
size: 1234,
name: './foo.js'
}]
};
var depsTree = size_tree.dependencySizeTree(webpackOutput);
chai_1.expect(depsTree).to.deep.equal({
packageName: '<root>',
size: 1234,
children: [{
packageName: 'dep',
size: 1234,
children: []
}]
});
});
});
{
"name": "webpack-bundle-size-analyzer",
"version": "1.0.2",
"version": "1.0.3",
"description": "A utility to find how your dependencies are contributing to the size of your Webpack bundles",

@@ -5,0 +5,0 @@ "main": "build/size_tree.js",

@@ -57,1 +57,19 @@ Webpack Bundle Size Analyzer

### Important Note About Minification
The statistics reported for modules in Webpack's JSON output do
take into account transformations resulting from loaders, but
not plugins which operate on the whole generated bundle.
The [recommended approach](http://webpack.github.io/docs/optimization.html)
to minifying JavaScript in Webpack bundles is to use the UglifyJS plugin,
which operates on the whole bundle. Consequently the stats shown by analyze-bundle-size
will report sizes _before_ minification. This should still give a pretty good idea of what
contributes to your bundle size but some libraries will compress better than others,
so they can be misleading.
A workaround is to generate a Webpack build using [the UglifyJS loader](https://www.npmjs.com/package/uglify-loader)
instead and use the JSON output from that. Since the loader runs on individual files before they are bundled,
the accounting will be correct.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc