webpack-contrib / webpack-bundle-analyzer

Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap
MIT License
12.53k stars 479 forks source link

Reduce installation size #609

Closed SukkaW closed 11 months ago

SukkaW commented 11 months ago

The PR follows #505. The PR reduces node_modules size after npm i webpack-bundle-analyzer with 2 changes:

Comparison

Running npm i --omit=dev --omit=optional against webpack-contrib/webpack-bundle-analyzer:master:

image

Running npm i --omit=dev --omit=optional against sukkaw/webpack-bundle-analyzer:optimize-install-size:

image
valscion commented 10 months ago

This PR and #505 have been released in v4.9.1 now ☺️. Thank you for your contributions!

stof commented 10 months ago

the usage of those individual packages is discouraged: https://lodash.com/per-method-packages

Also, as soon as another package also depends on lodash, this change actually increases the size of node_modules as lodash was deduplicated before.

valscion commented 10 months ago

Thanks @stof. So we should probably revert these changes then. @SukkaW would you be up for that?

SukkaW commented 10 months ago

Thanks @stof. So we should probably revert these changes then. @SukkaW would you be up for that?

For most of my projects, the only copy of lodash was introduced by the webpack-bundle-analyzer.

Since lodash is essentially dead (hasn't been maintained for years), IMHO instead of reverting back to lodash, replacing all lodash.* packages with maintained, performant, and lightweight packages would be a better approach. I will have opened a PR (#612) to do that.

stof commented 10 months ago

Well, lodash is indeed kinda dead since 3 years. But the per-method packages have last been released 7 years ago. So they are still missing 4 years of work in the lodash package.