Open Closed

Pre-rendering/Lazy Loading Blazor Webassembly #3631


0
listtraderdev2 created

Is there a way to perform pre-rendering or Lazy load a blazor webassembly project? Or better still, is there an ABP way of making the a blazor webassembly app load faster The initial loading of my app just takes too long. I have read the following articles to fix the problem. but they all made reference to an app.razor file which is not included in the generated project.

https://docs.microsoft.com/en-us/aspnet/core/blazor/webassembly-lazy-load-assemblies?view=aspnetcore-6.0 https://jonhilton.net/blazor-wasm-prerendering/ https://jonhilton.net/blazor-prerendering-net6/ https://www.c-sharpcorner.com/article/lazyloading-in-blazor/ https://www.meziantou.net/lazy-load-assemblies-in-a-blazor-webassembly-application.htm


1 Answer(s)
  • 0
    enisn created
    Support Team

    App.razor files are part of the UI Theme. Each time implements it according to their requirements. You can create a new App.razor in your project and use it.

    But ABP Framework and Modules can't support Lazy Loading since they register their services into the dependency injection container and UI Components are resolved from ServiceProvider before rendering. So, that logic makes all of them replaceable from outside of the original assembly.

    You can see this issue: https://github.com/abpframework/abp/issues/5543

    But Blazorise supports it by default and you don't need to do any configuration. It loads required js and dll files when you use a component.


    UPDATE: There is a useful article about it: https://community.abp.io/posts/prerendering-blazor-wasm-application-with-abp-6.x-2v8590g3