Preload Blazor WebAssembly resources to improve startup time #58875
Labels
area-blazor
Includes: Blazor, Razor Components
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
feature-blazor-wasm
This issue is related to and / or impacts Blazor WebAssembly
Perf
Priority:1
Work that is critical for the release, but we could probably ship without
triaged
Milestone
We want to add preload links for all the files that are on the critical path (dotnet.js, dotnet.runtime.js, dotnet.native.js, dotnet.wasm, boot.js) so the browser can start downloading them eagerly.
In runtime sample we do https://github.com/dotnet/runtime/blob/main/src/mono/sample/wasm/browser-advanced/index.html#L13-L16.
In .NET 9 we have split list of assemblies to "core" (required to started MonoVM) and "others". Preloading core assemblies with lower priority also seems like a good fit.
Implementation plan
rel
,as
,fetchpriority
,crossorigin
,integrity
)StaticWebAssetProjectMode=Default
orOverrideHtmlAssetPlaceholders=true
we can determine whether to use fingerprinted endpoint for dotnet.js and dotnet.boot.jsOverrideHtmlAssetPlaceholders=true
featureEndpointHtmlRenderer.WriteComponentHtml
) read preloading properties from endpoints and supply them to the initial response asLink
headersWebAssembly
render mode, not inAuto
modeAdditional tasks
The text was updated successfully, but these errors were encountered: