When you start building solutions with SPFx, there's a nice way to view what kind of packages you are producing. As part of the toolchain, Microsoft has included Webpack Visualizer, which produces a nice overview of your overall bundle. This overview is accessible under /temp/stats, in a .html file:
This sample SPFx web part project is about 20 KB without any optimizations.
To deploy code in production, as discussed in Chapter 6, Packaging and Deploying Solutions, use the ship parameter with gulp bundle to minify the dependent packages:
We can see from the preceding output that instead of a DEBUG build, this will be a SHIP build. The WEBPACK VISUALIZER now shows an, even more, slimmed-down release:
From roughly 20 KB down to 6.8 KB, this is about 65 % smaller with just one command. This is even more evident in larger projects.