Skip to content

Configuring Lazy Loading @ WebAssembly

Ivan Sanz Carasa edited this page May 4, 2020 · 7 revisions

The following nuget package includes everything you need to support lazy loading on Blazor WebAssembly (when statically published, using DevServer or using DualMode).

It can be installed by adding the following line inside the host csproj:

<PackageReference Include="BlazorLazyLoading.Wasm" Version="1.0.0" PrivateAssets="all" />

It will also require to be initialized from Program.cs by adding the following lines:

builder.Services.AddLazyLoading(new LazyLoadingOptions
{
    ModuleHints = new[] { "ModulesHost" }
});

LazyLoadingOptions

  • ModuleHints

    In order to find the _lazy.json manifest files and DLLs, you need to specify at least an entry-point to a lazy module. This must be done by passing the "known modules" as string.

    Specifies a list of Module Names (hints) to:

    • Download DLLs from them
    • Use their manifest to locate lazy resources