BlazorLazyLoad is mostly loudly shared idea/concept of assembly lazy load in Blazor WASM application. Splitting an application speeds up its start and also saves network traffic.
- Lazy loads assemblies.
- Lazy resolving on both page and component level.
- Registers included pages for routing.
- Registers included services to ServiceProvider.
- Include Nuget package - https://www.nuget.org/packages/BlazorLazyLoad/ in Blazor WASM application's project.
- Create custom assembly lazy load handler. The \Samples\01\BlazorApp\AreaAssemblyLazyLoadResolver.cs might be good example - it expects areas split strategy. The resolver can also register the services defined in the lazy loaded assembly.
- Change Router in App.razor to the enhanced one. That invokes AssemblyLazyLoadResolver when a lazy loaded page is navigated at first (entered to navigation bar or on the page refresh).
- Register services - call builder.Services.AddLazyLoad(); within Program.Main() method.
- Redirect navigation event to custom handler - see \Samples\01\BlazorApp\wwwroot\index.html.
- Create project containing lazy loaded pages - see \Samples\01\LazyLoadedArea.
- The built assembly has to be copied from wwwroot\_framework\_bin to the main project's wwwroot\_framework\bin folder. It's recommended to use gzipped versions.
- See \Samples\01\BlazorApp\Pages\LazyComponent for component level lazy loading.
- All is provided as is without any warranty.
- The target of this concept has been "make it functional for any price". Therefore some pieces are bit "hacky".
- Developed with version 3.2.0 wasm.