Recently I had some time to take a look at the performance of my pet project. One thing bothered me: the project is relatively small, but the bundle size was too big: 780 KiB
. Whereas the project had only a few dependencies: react
(~10 KiB), react-router
(~70 KiB), react-dom
(~90 KiB), dayjs
(~3 KiB), lodash
(~70 KiB). The bundle should not be that big for so few dependencies.
So I ran webpack-dev-analyzer
and found a weird thing: the sum of the libs is 3 times smaller than the final bundle size. Then I decided to take a look at @statoscope/webpack-plugin
. It was a good tool but it gave me the same result. The bundle has way too much trash.
Ok. Probably it’s just webpack wrappers over 300+ small modules.