I have followed the tutorial to add webpack to Angular from here. If I understand correctly we feed the main module to webpack and then it traverses the whole tree and adds all the referenced files to the bundle. I have also read that we can optimize this by using tree-shaking.
What I don't understand here is why do we need tree-shaking if webpack already scans for only "used" modules (i.e. the ones we "import").
Does tree-shaking do something additional (like checking the classes from the modules that are not used and removing them from the module even though it's imported?) or I misunderstand the concept alltogether?