-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
PerfPriority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyThis issue is related to and / or impacts Blazor WebAssemblytriaged
Milestone
Description
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
- In WebAssembly SDK identify key assets and add preloading properties to endpoints (
rel,as,fetchpriority,crossorigin,integrity)- Preload dotnet.js
- Preload boot config
- Preload dotnet.*.js
- Preload dotnet.*.wasm
- Preload core dlls with lower priority
- Based on
StaticWebAssetProjectMode=DefaultorOverrideHtmlAssetPlaceholders=truewe can determine whether to use fingerprinted endpoint for dotnet.js and dotnet.boot.js - Based on measurements the best results provided inlining boot config to dotnet.js & preloading dotnet.js
- In StaticWebAssets SDK introduce a new placeholder for preloading meta tags in
OverrideHtmlAssetPlaceholders=truefeature - In AspNetCore runtime (
EndpointHtmlRenderer.WriteComponentHtml) read preloading properties from endpoints and supply them to the initial response asLinkheaders- Do it only for
WebAssemblyrender mode, not inAutomode
- Do it only for
Additional tasks
- Consider merging boot config into dotnet.js based if preloading measurements prove it's benefitial
boukenka, rogihee, Amine-Smahi, SebZal, gpproton and 10 moreAslanAmca, MarianSWA, alc-aardvark and Kaayo
Metadata
Metadata
Assignees
Labels
PerfPriority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyThis issue is related to and / or impacts Blazor WebAssemblytriaged