egoist / package-size

Get the bundle size of an npm package.
MIT License
425 stars 26 forks source link

Package bundle size calculation is incorrect #17

Closed jasongerbes closed 5 years ago

jasongerbes commented 5 years ago

The size of package bundle is incorrectly calculated.

For example, notice below how react + react-dom is larger than react + react-dom + react-transition-group.

C:\>package-size react react-dom react-transition-group react,react-dom react,react-dom,react-transition-group

  package                                                     size       minified   gzipped
  react@16.6.0                                                66.53 KB   7.1 KB     2.77 KB
  react-dom@16.6.0                                            722.68 KB  101.9 KB   32.54 KB
  react-transition-group@2.5.0                                94.89 KB   17.9 KB    4.79 KB
  react@16.6.0,react-dom@16.6.0                               722.83 KB  101.91 KB  32.54 KB
  react@16.6.0,react-dom@16.6.0,react-transition-group@2.5.0  95.25 KB   17.91 KB   4.79 KB
egoist commented 5 years ago

Ah I think it accidentally externalized react and react-dom when bundling with react-transition-group:

https://github.com/egoist/package-size/blob/d527d2adef9abe0eb9db6770530ebde90a9b88bc/lib/index.js#L114-L116

Will fix later (PR welcome too)

egoist commented 5 years ago

Should be fixed in 2.1.2

2018-11-27 1 58 16