webpack-bundle-size-analyzer
Advanced tools
@@ -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: [] | ||
| }] | ||
| }); | ||
| }); | ||
| }); |
+1
-1
| { | ||
| "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", |
+18
-0
@@ -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. | ||
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
9976
22.51%162
20.9%75
31.58%