Comparing packaged sizes between Webpack 4 and 5

Webpack 5 was released on Oct 2020. In the official release statement —, Webpack 5 has improvements in code generation and general tree shaking. Let’s try some basic tests to see if there is any difference between the generated packages.

First, let’s try to setup a single environment with both version of webpack. Although it will be easier to just have 2 separate setup installed with different version of webpack each.

npm i webpack --save-dev