Skip to content

Configuring Lazy Loading @ WebAssembly

Ivan Sanz Carasa edited this page May 1, 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

    Specifies a list of Module Names (hints) to:

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

    x