Decreasing the initial download size with assembly lazy loading
In single-page applications in general and Blazor WebAssembly specifically, the full app packages, scripts, and stylesheets are downloaded for the first time to the browser so the app is fully functional on the client side. The average Blazor WebAssembly app has a size of 2 MB when it is published. That’s not very big, but when the app gets more complicated and more packages and assemblies are involved, the size can increase significantly.
In this section, we will learn about Blazor WebAssembly’s lazy loading feature, which was released in .NET 6.0 to help reduce the initial download size to make first-time loading faster. Additionally, Blazor provides some out-of-the-box features, such as runtime relinking, compression, and trimming, that decrease the app size, but we will cover those features in the Blazor WebAssembly app prerelease final checks section Chapter 14, Publishing Blazor WebAssembly Apps...