-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Hi guys,
Since .NET 7 is out, I've been test driving Blazor WASM to see how to use it in combination with other frameworks.
I've configured the following to be able to point the loading of resources to a specific server.
https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/startup?view=aspnetcore-7.0#load-boot-resources
Which works nicely.
I'm now using the Microsoft.AspNetCore.Components.CustomElements nuget package to get CustomElements to work.
Initially you had to reference the script manually:
<script src="_content/Microsoft.AspNetCore.Components.CustomElements/BlazorCustomElements.js"></script>But since .NET 7 has been released it's lazy loaded by ASP.NET. Which is awesome. The only problem is: it uses the URL of the server you are on, to lazy load the file, while it should be respecting the loadBootResource configuration.
Which is a problem for me, as I'm depending on the loadBootResource function to get the WASM files from another server, for example a CDN.
Is that something you guys can fix?
cc: @guardrex dotnet/AspNetCore.Docs#27638
Expected Behavior
Loading the JS for CustomElements should respect the loadBootResource configuration.
Steps To Reproduce
- Create a Blazor WASM client app
- Create a simple webserver that loads the Blazor script with
autostart="false"and add the following bootstrapping lines:
Blazor.start({
loadBootResource: function (type, name, defaultUri, integrity) {
return 'https://localhost:8088/' + defaultUri`;
}
});- Install the CustomElements nuget and implement a basic customelement.
- Try loading the basic webserver with the customelement and blazor script.
Exceptions (if any)
No response
.NET Version
7
Anything else?
No response